[PATCH 2 of 9 Registration cube] [py3] remove useless try/except, use new except syntax

Nsukami Patrick ptrck at nskm.xyz
Wed Apr 1 12:50:05 CEST 2020


# HG changeset patch
# User Nsukami Patrick <ptrck at nskm dot xyz>
# Date 1585672678 0
#      Tue Mar 31 16:37:58 2020 +0000
# Node ID 6ab69ed20fc6448790dd9298dfe951d5049f204e
# Parent  60b867364238ef386f79cd6c63f3538bc569ccbb
[py3] remove useless try/except, use new except syntax

diff --git a/cubicweb_registration/views.py b/cubicweb_registration/views.py
--- a/cubicweb_registration/views.py
+++ b/cubicweb_registration/views.py
@@ -25,10 +25,7 @@
 from cubicweb.web import formwidgets as fw, formfields as ff
 from cubicweb.web.views import forms, basecomponents, urlrewrite
 
-try:
-    from cubicweb import _
-except ImportError:
-    _ = unicode
+from cubicweb import _
 
 
 def qname(attr):
@@ -159,7 +156,7 @@
                                  firstname=data.get(qname('firstname')),
                                  surname=data.get(qname('surname')))
                 cnx.commit()
-        except ValidationError, err:
+        except ValidationError as err:
             if 'login' in err.errors and 'unicity constraint' in err.errors['login']:
                 err.errors.pop('', None)
                 err.errors.pop('login', None)




More information about the cubicweb-devel mailing list