diff options
-rwxr-xr-x | manager.py | 4 | ||||
-rw-r--r-- | migrations/versions/422da2d0234_adding_filters_field.py | 22 | ||||
-rw-r--r-- | pyaggr3g470r/models/feed.py | 1 |
3 files changed, 25 insertions, 2 deletions
@@ -1,8 +1,6 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -import asyncio - from bootstrap import application, db, populate_g from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand @@ -39,6 +37,8 @@ def fetch(user, password, limit=100, retreive_all=False): @manager.command def fetch_asyncio(user_id, feed_id): "Crawl the feeds with asyncio." + import asyncio + with application.app_context(): populate_g() from pyaggr3g470r.models import User diff --git a/migrations/versions/422da2d0234_adding_filters_field.py b/migrations/versions/422da2d0234_adding_filters_field.py new file mode 100644 index 00000000..bcbdf042 --- /dev/null +++ b/migrations/versions/422da2d0234_adding_filters_field.py @@ -0,0 +1,22 @@ +"""adding filters field + +Revision ID: 422da2d0234 +Revises: 17dcb75f3fe +Create Date: 2015-05-18 23:03:15.809549 + +""" + +# revision identifiers, used by Alembic. +revision = '422da2d0234' +down_revision = '17dcb75f3fe' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.add_column('feed', sa.Column('filters', sa.PickleType(), nullable=True)) + + +def downgrade(): + op.drop_column('feed', 'filters') diff --git a/pyaggr3g470r/models/feed.py b/pyaggr3g470r/models/feed.py index e43045f1..793642fb 100644 --- a/pyaggr3g470r/models/feed.py +++ b/pyaggr3g470r/models/feed.py @@ -42,6 +42,7 @@ class Feed(db.Model): site_link = db.Column(db.String(), default="") enabled = db.Column(db.Boolean(), default=True) created_date = db.Column(db.DateTime(), default=datetime.now) + filters = db.Column(db.PickleType, default=[]) # cache handling etag = db.Column(db.String(), default="") |