Correction
authorCyril Robert <Cyril Robert crobert@inverse.ca>
Fri, 19 Feb 2010 20:58:08 +0000 (15:58 -0500)
committerCyril Robert <Cyril Robert crobert@inverse.ca>
Fri, 19 Feb 2010 20:58:08 +0000 (15:58 -0500)
Apps/roundup/auf_roa.py

index 8918668..b3a922d 100644 (file)
@@ -28,15 +28,18 @@ class AufRoaLoginAction(LoginAction):
             self.client.error_message.append(_("Compte invalide ou erreur ROA"))
             return
 
-        props = {'realname': "%s %s" % (user['first_name'], user['last_name']),
-                 'username': user['email'],
-                 'address': user['email']}
-        self.journaltag = 'admin'
-        cl = self.db.user
-        props['roles'] = self.db.config.NEW_WEB_USER_ROLES
-        self.userid = cl.create (**props)
-        self.db.commit ()
-        self.client.userid = self.db.user.lookup(self.client.user)
+        try:
+            self.client.userid = self.db.user.lookup(self.client.user)
+        except:
+            props = {'realname': "%s %s" % (user['first_name'], user['last_name']),
+                     'username': user['email'],
+                     'address': user['email']}
+            self.journaltag = 'admin'
+            cl = self.db.user
+            props['roles'] = self.db.config.NEW_WEB_USER_ROLES
+            self.userid = cl.create (**props)
+            self.db.commit ()
+            self.client.userid = self.db.user.lookup(self.client.user)
 
 def init(instance):
     instance.registerAction('login', AufRoaLoginAction)