- Timestamp:
- 1 Jan 2009, 16:45:08 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/app.py
r3530 r3830 1 1 import grok 2 2 from grok import index 3 from zope.component import getUtility 3 4 from zope.interface import Interface 4 from interfaces import IUniversity 5 from setup import app_setup 6 from viewlets import MainArea 5 6 from waeup.interfaces import (IUniversity, IStudentContainer, IHostelContainer, 7 IFacultyContainer) 8 from waeup.viewlets import MainArea 7 9 8 10 class University(grok.Application, grok.Container): 11 """A university. 12 """ 9 13 grok.implements(IUniversity) 10 14 … … 12 16 super(University, self).__init__(**kw) 13 17 self.name = name 14 app_setup.setup(self)18 self.setup() 15 19 20 def setup(self): 21 self["students"] = getUtility(IStudentContainer) 22 self["hostels"] = getUtility(IHostelContainer) 23 self["faculties"] = getUtility(IFacultyContainer) 24 25 class Manage(grok.EditForm): 26 """Manage the basic properties of a `University` instance. 27 """ 28 29 grok.require('waeup.ManageUniversity') 30 31 form_fields = grok.AutoFields(IUniversity) 32 33 @grok.action('Save') 34 def save(self, **data): 35 self.applyData(self.context, **data) 36 return 37 38 @grok.action('Save and return') 39 def saveAndReturn(self, **data): 40 self.applyData(self.context, **data) 41 self.redirect(self.url(self.context)) 42 return 43 44 @grok.action('Cancel') 45 def cancel(self): 46 self.redirect(self.url(self.context)) 47 return 48 16 49 class Content(grok.Viewlet): 17 50 grok.viewletmanager(MainArea)
Note: See TracChangeset for help on using the changeset viewer.