Changeset 8858 for main/waeup.kofa/trunk/src/waeup/kofa/mandates
- Timestamp:
- 30 Jun 2012, 07:39:07 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/mandates
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py
r8857 r8858 55 55 56 56 def _setPassword(self): 57 user _id = self.params.get('user_id', None)57 user = self.params.get('user', None) 58 58 pwd = self.params.get('password', None) 59 user_type = self.params.get('user_type', None)60 user = None61 if user_type == 'student':62 user = grok.getSite()['students'].get(user_id, None)63 elif user_type == 'officer':64 user = grok.getSite()['users'].get(user_id, None)65 59 if user and pwd: 66 IUserAccount(user).setPassword(pwd) 67 return True 60 try: 61 IUserAccount(user).setPassword(pwd) 62 return True 63 except: 64 return False 68 65 return False 69 66 -
main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py
r8857 r8858 99 99 # Add and execute a perfect mandate 100 100 mandate = PasswordMandate() 101 mandate.params['user _id'] = student.student_id101 mandate.params['user'] = student 102 102 mandate.params['password'] = 'mypwd1' 103 mandate.params['user_type'] = 'student'104 103 self.app['mandates'].addMandate(mandate) 105 104 msg = mandate.execute() … … 115 114 officer = self.app['users']['bob'] 116 115 mandate = PasswordMandate() 117 mandate.params['user _id'] = 'bob'116 mandate.params['user'] = officer 118 117 mandate.params['password'] = 'mypwd1' 119 mandate.params['user_type'] = 'officer'120 118 self.app['mandates'].addMandate(mandate) 121 119 msg = mandate.execute() … … 142 140 self.app['students'].addStudent(student) 143 141 mandate = PasswordMandate() 144 mandate.params['user_id'] = student.student_id 145 mandate.params['user_type'] = 'student' 142 mandate.params['user'] = student 146 143 mandate.params['password'] = 'mypwd1' 147 144 self.app['mandates'].addMandate(mandate)
Note: See TracChangeset for help on using the changeset viewer.