Mercurial > kallithea
comparison pylons_app/model/forms.py @ 490:74b9bed279ae celery
fixed validation of user email in user creation, and editing on admin panel
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 20 Sep 2010 22:55:55 +0200 |
parents | 460ad816820d |
children | 6d44d3862ec4 |
comparison
equal
deleted
inserted
replaced
489:460ad816820d | 490:74b9bed279ae |
---|---|
210 error_dict={'paths_root_path':msg}) | 210 error_dict={'paths_root_path':msg}) |
211 | 211 |
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['email'] != value: | 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() |
219 if user: | 219 if user: |
220 raise formencode.Invalid(_("That e-mail address is already taken") , | 220 raise formencode.Invalid(_("That e-mail address is already taken") , |