Pārlūkot izejas kodu

Fix update user email

Bastien Sevajol (Algoo) 8 gadus atpakaļ
vecāks
revīzija
9e1928790d
1 mainītis faili ar 8 papildinājumiem un 4 dzēšanām
  1. 8 4
      tracim/tracim/controllers/user.py

+ 8 - 4
tracim/tracim/controllers/user.py Parādīt failu

@@ -1,5 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 import pytz
3
+from sqlalchemy.orm.exc import NoResultFound
3 4
 from tracim.lib import CST
4 5
 from webob.exc import HTTPForbidden
5 6
 import tg
@@ -176,10 +177,13 @@ class UserRestController(TIMRestController):
176 177
         else:
177 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 188
         # Only keep allowed field update
185 189
         updated_fields = self._clean_update_fields({