Changeset 4634 for waeup/branches/ulif-layout
- Timestamp:
- 2 Jan 2010, 14:31:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/users.py
r4631 r4634 17 17 grok.require('waeup.manageUsers') 18 18 19 def addUser(self, name, password, title=None, description=None ):19 def addUser(self, name, password, title=None, description=None, roles=[]): 20 20 if title is None: 21 21 title = name 22 22 if description is None: 23 23 description = title 24 self[name] = Account(name, password, title, description )24 self[name] = Account(name, password, title, description, roles) 25 25 26 26 def addAccount(self, account): … … 30 30 if name in self.keys(): 31 31 del self[name] 32 33 34 class AddUserForm(grok.AddForm):35 grok.require('waeup.manageUsers')36 grok.context(UserContainer)37 form_fields = grok.AutoFields(IUserAccount)38 label = 'Add user'39 40 @grok.action('Add user')41 def addFaculty(self, **data):42 #user = Account(**data)43 name = data['name']44 title = data['title']45 description = data['description']46 password = data['password']47 try:48 self.context.addUser(name, password, title=title,49 description=description)50 except DuplicationError:51 self.status = Invalid('The userid chosen already exists '52 'in the database')53 return54 self.redirect(self.url(self.context))55 56 class AddUser(FormWrapMixin, grok.Viewlet):57 """A viewlet that wraps the `AddUserForm`.58 """59 grok.viewletmanager(MainArea)60 grok.context(UserContainer)61 grok.view(Add)62 grok.require('waeup.manageUsers')63 64 formview_name = 'adduserform' # The name of the formview we want65 # to be rendered in this viewlet.
Note: See TracChangeset for help on using the changeset viewer.