Changeset 4594
- Timestamp:
- 1 Jan 2010, 15:54:55 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser/pages.py
r4584 r4594 4 4 import grok 5 5 from waeup.browser import WAeUPPage, WAeUPEditFormPage 6 from waeup.interfaces import IUniversity 6 from waeup.interfaces import IUniversity, IWAeUPObject 7 7 from waeup.widgets.interfaces import ITableProvider 8 8 9 9 grok.templatedir('templates') 10 11 class LoginPage(WAeUPPage): 12 """A login page, available for all objects. 13 """ 14 grok.name('login') 15 grok.context(IWAeUPObject) 16 17 title = u'Login' 18 camefrom = None 19 20 def update(self, SUBMIT=None, camefrom=None): 21 self.camefrom = camefrom #self.request.form.get('camefrom', '') 22 if SUBMIT is not None: 23 self.flash('You logged in.') 24 if not self.camefrom: 25 # User might have entered the URL directly. Let's beam 26 # him back to our context. 27 self.redirect(self.url(self.context)) 28 return 29 self.redirect(self.camefrom) 30 10 31 11 32 class UniversityPage(WAeUPPage): … … 14 35 grok.name('index') 15 36 grok.context(IUniversity) 16 17 def update(self): 18 self.table = ITableProvider(self.context).getTables(self)[0] 19 self.table.need() 37 title = u'Welcome to SRP' 38 20 39 21 40 class Manage(WAeUPEditFormPage): … … 25 44 grok.context(IUniversity) 26 45 grok.require('waeup.manageUniversity') 46 title = u'Edit settings' 27 47 28 48 @grok.action('Save') 29 49 def save(self, **data): 30 50 self.applyData(self.context, **data) 51 self.flash('Settings have been saved.') 31 52 return 32 53 … … 35 56 self.applyData(self.context, **data) 36 57 self.redirect(self.url(self.context)) 58 self.flash('Settings have been saved.') 37 59 return 38 60
Note: See TracChangeset for help on using the changeset viewer.