Show More
@@ -98,7 +98,10 class UsersController(BaseController): | |||||
98 | # method='put') |
|
98 | # method='put') | |
99 | # url('user', id=ID) |
|
99 | # url('user', id=ID) | |
100 | user_model = UserModel() |
|
100 | user_model = UserModel() | |
101 | _form = UserForm(edit=True, old_data={'user_id':id})() |
|
101 | c.user = user_model.get_user(id) | |
|
102 | ||||
|
103 | _form = UserForm(edit=True, old_data={'user_id':id, | |||
|
104 | 'email':c.user.email})() | |||
102 | form_result = {} |
|
105 | form_result = {} | |
103 | try: |
|
106 | try: | |
104 | form_result = _form.to_python(dict(request.POST)) |
|
107 | form_result = _form.to_python(dict(request.POST)) | |
@@ -106,7 +109,6 class UsersController(BaseController): | |||||
106 | h.flash(_('User updated succesfully'), category='success') |
|
109 | h.flash(_('User updated succesfully'), category='success') | |
107 |
|
110 | |||
108 | except formencode.Invalid as errors: |
|
111 | except formencode.Invalid as errors: | |
109 | c.user = user_model.get_user(id) |
|
|||
110 | return htmlfill.render( |
|
112 | return htmlfill.render( | |
111 | render('admin/users/user_edit.html'), |
|
113 | render('admin/users/user_edit.html'), | |
112 | defaults=errors.value, |
|
114 | defaults=errors.value, |
@@ -212,7 +212,7 class ValidPath(formencode.validators.Fa | |||||
212 | def UniqSystemEmail(old_data): |
|
212 | def UniqSystemEmail(old_data): | |
213 | class _UniqSystemEmail(formencode.validators.FancyValidator): |
|
213 | class _UniqSystemEmail(formencode.validators.FancyValidator): | |
214 | def to_python(self, value, state): |
|
214 | def to_python(self, value, state): | |
215 |
if old_data |
|
215 | if old_data.get('email') != value: | |
216 | sa = meta.Session |
|
216 | sa = meta.Session | |
217 | try: |
|
217 | try: | |
218 | user = sa.query(User).filter(User.email == value).scalar() |
|
218 | user = sa.query(User).filter(User.email == value).scalar() |
General Comments 0
You need to be logged in to leave comments.
Login now