Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """seed rss feeds
- Revision ID: 4296ad40d9d5
- Revises: 4465bb008a8a
- Create Date: 2014-07-30 20:23:31.363516
- """
- # revision identifiers, used by Alembic.
- revision = '4296ad40d9d5'
- down_revision = '4465bb008a8a'
- from alembic import op
- import sqlalchemy as sa
- import time
- import datetime
- from dateutil.parser import parse
- import pytz
- def upgrade():
- """Preseed data into the system."""
- current_context = op.get_context()
- meta = current_context.opts['target_metadata']
- rssfeed = sa.Table('rssfeeds', meta, autoload=True)
- # t0 = time.gmtime(0)
- # # convert the struct_time to a datetime
- # latest_post = datetime.datetime(*t0[:6])
- # 'Fri, 01 Aug 2014 00:41:29 +0000' %a, %d %b %Y %H:%M:%S %z
- latest_post = datetime.datetime(1970, 1, 1, 1, 1, 1, 1, pytz.UTC) # a long time ago
- # Add the initial admin rssfeed account.
- op.bulk_insert(rssfeed, [{
- 'url': u'http://www.utah.gov/whatsnew/rss.xml',
- 'name': u'utah',
- 'latestpost': latest_post,
- }
- ])
- def downgrade():
- pass
Advertisement
Add Comment
Please, Sign In to add comment