浏览代码

Fix update user email

Bastien Sevajol (Algoo) 8 年前
父节点
当前提交
9e1928790d
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      tracim/tracim/controllers/user.py

+ 8 - 4
tracim/tracim/controllers/user.py 查看文件

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
 import pytz
2
 import pytz
3
+from sqlalchemy.orm.exc import NoResultFound
3
 from tracim.lib import CST
4
 from tracim.lib import CST
4
 from webob.exc import HTTPForbidden
5
 from webob.exc import HTTPForbidden
5
 import tg
6
 import tg
176
         else:
177
         else:
177
             next = self.url()
178
             next = self.url()
178
 
179
 
179
-        email_user = user_api.get_one_by_email(email)
180
-        if email_user != current_user:
181
-            tg.flash(_('Email already in use'), CST.STATUS_ERROR)
182
-            tg.redirect(next)
180
+        try:
181
+            email_user = user_api.get_one_by_email(email)
182
+            if email_user != current_user:
183
+                tg.flash(_('Email already in use'), CST.STATUS_ERROR)
184
+                tg.redirect(next)
185
+        except NoResultFound:
186
+            pass
183
 
187
 
184
         # Only keep allowed field update
188
         # Only keep allowed field update
185
         updated_fields = self._clean_update_fields({
189
         updated_fields = self._clean_update_fields({