def create(self, data): # create user user = CrowdUser(data['name'], data['login'], data['login']) # set password user.password = ptah.passwordTool.encode(data['password']) Session.add(user) Session.flush() return user
def create(self): data, errors = self.extract() if errors: self.message(errors, 'form-error') return # create user user = CrowdUser(data['name'], data['login'], data['login']) # set password user.password = ptah.passwordTool.encode(data['password']) Session.add(user) Session.flush() self.request.registry.notify(PrincipalAddedEvent(user)) self.message('User has been created.', 'success') raise HTTPFound(location='./')