Changeset 4111
- Timestamp:
- 6 May 2009, 06:51:47 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/users.py
r4104 r4111 1 """Users (principal ) for the WAeUP portal.1 """Users (principals) for the WAeUP portal. 2 2 """ 3 3 import grok 4 4 from hurry import yui 5 5 from waeup.authentication import Account 6 from waeup.interfaces import IUserContainer 7 from waeup.viewlets import LeftSidebar, MainArea, Index 6 from waeup.interfaces import IUserContainer, IUserAccount 7 from waeup.viewlets import LeftSidebar, MainArea, Index, Manage, FormWrapMixin 8 8 9 9 class UserContainer(grok.Container): … … 34 34 grok.name('index') 35 35 36 def update(self ):36 def update(self, userid=None, adduser=None, edit=None, delete=None): 37 37 yui.sam.need() 38 38 yui.datatable.need() 39 40 if edit is not None and userid is not None: 41 self.redirect(self.url(userid)) 39 42 40 43 def render(self, *args, **kw): … … 47 50 grok.view(UserContainerView) 48 51 52 53 class UserEditForm(grok.EditForm): 54 grok.context(IUserAccount) 55 form_fields = grok.AutoFields(IUserAccount) 56 grok.require('waeup.manageUsers') 57 58 @grok.action('Save') 59 def save(self, **data): 60 self.applyData(self.context, **data) 61 self.flash('User was modified.') 62 return 63 64 @grok.action('Save and return') 65 def saveAndReturn(self, **data): 66 self.applyData(self.context, **data) 67 self.flash('User was modified.') 68 self.redirect(self.url(self.context.__parent__)) 69 return 70 71 @grok.action('Cancel') 72 def cancel(self, **data): 73 self.redirect(self.url(self.context.__parent__)) 74 return 75 76 77 class UserEditMain(FormWrapMixin, grok.Viewlet): 78 """A viewlet that renders the `UserEditForm`. 79 """ 80 grok.viewletmanager(MainArea) 81 grok.context(IUserAccount) 82 grok.view(Index) 83 grok.require('waeup.manageUsers') 84 85 formview_name = 'usereditform' # The name of the formview we want to 86 # be rendered in this viewlet.
Note: See TracChangeset for help on using the changeset viewer.