entities/adapters.py
changeset 10301 729f36a1bcfa
parent 10262 5c2a4a0a8dbd
parent 10280 2cdab5e33542
child 10446 1e6655cff5ab
--- a/entities/adapters.py	Wed Mar 25 10:10:24 2015 +0100
+++ b/entities/adapters.py	Wed Apr 22 10:08:14 2015 +0200
@@ -20,6 +20,7 @@
 """
 
 __docformat__ = "restructuredtext en"
+_ = unicode
 
 from itertools import chain
 from warnings import warn
@@ -361,11 +362,13 @@
     __select__ = match_exception(UniqueTogetherError)
 
     def raise_user_exception(self):
-        _ = self._cw._
         rtypes = self.exc.rtypes
-        rtypes_msg = {}
+        errors = {}
+        msgargs = {}
+        i18nvalues = []
         for rtype in rtypes:
-            rtypes_msg[rtype] = _('%s is part of violated unicity constraint') % rtype
-        globalmsg = _('some relations violate a unicity constraint')
-        rtypes_msg['unicity constraint'] = globalmsg
-        raise ValidationError(self.entity.eid, rtypes_msg)
+            errors[rtype] = _('%(KEY-rtype)s is part of violated unicity constraint')
+            msgargs[rtype + '-rtype'] = rtype
+            i18nvalues.append(rtype + '-rtype')
+        errors[''] = _('some relations violate a unicity constraint')
+        raise ValidationError(self.entity.eid, errors, msgargs=msgargs, i18nvalues=i18nvalues)