Changeset 1319:3cbfda759c44
- Timestamp:
- 07/19/09 17:17:22 (3 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
external-plugins/eric_the_fish/__init__.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
external-plugins/eric_the_fish/__init__.py
r1314 r1319 45 45 from zine.privileges import BLOG_ADMIN 46 46 47 # the last thing is importing the FORTUNES list from the fortunes.py file 48 # from the same folder. It's just a long list with quotes. 49 from zine.plugins.eric_the_fish.fortunes import FORTUNES 47 # import Zine's database related stuff 48 from zine.database import db 49 50 # the last thing is importing the Fortunes database mapped object. 51 from zine.plugins.eric_the_fish.database import Fortune 50 52 51 53 # because we have an admin panel page we need to store the templates … … 56 58 # here we do the same for the shared files (css, fish images and javascript) 57 59 SHARED_FILES = join(dirname(__file__), 'shared') 58 59 # here we do the same for our database upgrade's repository60 UPGRADES_REPO = dirname(__file__)61 60 62 61 # and that's just the list of skins we have. … … 92 91 for link_id, url, title, children in navigation_bar: 93 92 if link_id == 'options': 94 children.insert(-3, ('eric_the_fish', url_for('eric_the_fish/config'), 93 children.insert(-3, ('eric_the_fish', 94 url_for('eric_the_fish/config'), 95 95 _('Eric The Fish'))) 96 96 … … 119 119 120 120 def get_fortune(req): 121 """The servicepoint function. Just return one fortune from the list.""" 122 return {'fortune': choice(FORTUNES)} 121 """The servicepoint function. Just return one fortune from the database.""" 122 fortune_ids = db.session.query(Fortune.id).all() 123 return {'fortune': db.session.query(Fortune).get(choice(fortune_ids)).text} 123 124 124 def register_repository():125 print 'registering eric repo'126 get_application().register_upgrade_repository('eric_the_fish', UPGRADES_REPO)127 125 128 126 def setup(app, plugin): … … 132 130 """ 133 131 134 # we need to register eric's database upgrades repository 135 # app.connect_event('register-upgrade-repository', register_repository) 136 app.register_upgrade_repository(plugin, UPGRADES_REPO) 132 # we need to register eric's database upgrades repository; 133 # Basically it should be a folder which itself has another child folder 134 # named "versions" where the upgrade script(s) should reside. 135 # In "Eric the fish" case we pass the plugin's folder which has that child 136 # folder called "versions" 137 app.register_upgrade_repository(plugin, dirname(__file__)) 137 138 138 139 # we want our fish to appear in the admin panel, so hook into the
Note: See TracChangeset
for help on using the changeset viewer.