unique_together: recast exception raised by sqlite stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Wed, 15 Sep 2010 15:14:35 +0200
branchstable
changeset 6247 f7cb092d2296
parent 6246 62e25fac41cd
child 6248 3f89bf00e8ce
unique_together: recast exception raised by sqlite updated the translations (en + fr) while I was at it
i18n/en.po
i18n/es.po
i18n/fr.po
server/sources/native.py
--- a/i18n/en.po	Wed Sep 15 15:00:04 2010 +0200
+++ b/i18n/en.po	Wed Sep 15 15:14:35 2010 +0200
@@ -5,7 +5,7 @@
 msgstr ""
 "Project-Id-Version: 2.0\n"
 "POT-Creation-Date: 2006-01-12 17:35+CET\n"
-"PO-Revision-Date: 2010-05-16 18:58+0200\n"
+"PO-Revision-Date: 2010-09-15 14:55+0200\n"
 "Last-Translator: Sylvain Thenault <sylvain.thenault@logilab.fr>\n"
 "Language-Team: English <devel@logilab.fr.org>\n"
 "Language: en\n"
@@ -317,6 +317,12 @@
 msgid "CWRelation_plural"
 msgstr "Relations"
 
+msgid "CWUniqueTogetherConstraint"
+msgstr ""
+
+msgid "CWUniqueTogetherConstraint_plural"
+msgstr ""
+
 msgid "CWUser"
 msgstr "User"
 
@@ -496,6 +502,9 @@
 msgid "New CWRelation"
 msgstr "New relation"
 
+msgid "New CWUniqueTogetherConstraint"
+msgstr ""
+
 msgid "New CWUser"
 msgstr "New user"
 
@@ -686,6 +695,9 @@
 msgid "This CWRelation"
 msgstr "This relation"
 
+msgid "This CWUniqueTogetherConstraint"
+msgstr ""
+
 msgid "This CWUser"
 msgstr "This user"
 
@@ -880,6 +892,9 @@
 msgid "add CWRelation relation_type CWRType object"
 msgstr "relation definition"
 
+msgid "add CWUniqueTogetherConstraint constraint_of CWEType object"
+msgstr ""
+
 msgid "add CWUser in_group CWGroup object"
 msgstr "user"
 
@@ -1436,6 +1451,20 @@
 msgid "constraint factory"
 msgstr ""
 
+msgid "constraint_of"
+msgstr ""
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "constraint_of"
+msgstr ""
+
+msgid "constraint_of_object"
+msgstr ""
+
+msgctxt "CWEType"
+msgid "constraint_of_object"
+msgstr ""
+
 msgid "constraints"
 msgstr ""
 
@@ -1559,6 +1588,11 @@
 msgid "creating CWRelation (CWRelation relation_type CWRType %(linkto)s)"
 msgstr "creating relation %(linkto)s"
 
+msgid ""
+"creating CWUniqueTogetherConstraint (CWUniqueTogetherConstraint "
+"constraint_of CWEType %(linkto)s)"
+msgstr ""
+
 msgid "creating CWUser (CWUser in_group CWGroup %(linkto)s)"
 msgstr "creating a new user in group %(linkto)s"
 
@@ -1800,6 +1834,9 @@
 msgid "define how we get out from a sub-workflow"
 msgstr ""
 
+msgid "defines a sql-level multicolumn unique index"
+msgstr ""
+
 msgid ""
 "defines what's the property is applied for. You must select this first to be "
 "able to set value"
@@ -3116,9 +3153,27 @@
 msgid "relation_type_object"
 msgstr "relation definitions"
 
+msgid "relations"
+msgstr ""
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "relations"
+msgstr ""
+
 msgid "relations deleted"
 msgstr ""
 
+msgid "relations_object"
+msgstr ""
+
+msgctxt "CWAttribute"
+msgid "relations_object"
+msgstr ""
+
+msgctxt "CWRelation"
+msgid "relations_object"
+msgstr ""
+
 msgid "relative url of the bookmarked page"
 msgstr ""
 
@@ -3898,6 +3953,10 @@
 msgid "view_index"
 msgstr "index"
 
+#, python-format
+msgid "violates unique_together constraints (%s)"
+msgstr "violates unique_together constraints (%s)"
+
 msgid "visible"
 msgstr ""
 
--- a/i18n/es.po	Wed Sep 15 15:00:04 2010 +0200
+++ b/i18n/es.po	Wed Sep 15 15:14:35 2010 +0200
@@ -326,6 +326,12 @@
 msgid "CWRelation_plural"
 msgstr "Relaciones"
 
+msgid "CWUniqueTogetherConstraint"
+msgstr ""
+
+msgid "CWUniqueTogetherConstraint_plural"
+msgstr ""
+
 msgid "CWUser"
 msgstr "Usuario"
 
@@ -517,6 +523,9 @@
 msgid "New CWRelation"
 msgstr "Nueva definición de relación final"
 
+msgid "New CWUniqueTogetherConstraint"
+msgstr ""
+
 msgid "New CWUser"
 msgstr "Agregar usuario"
 
@@ -707,6 +716,9 @@
 msgid "This CWRelation"
 msgstr "Esta definición de relación no final"
 
+msgid "This CWUniqueTogetherConstraint"
+msgstr ""
+
 msgid "This CWUser"
 msgstr "Este usuario"
 
@@ -922,6 +934,9 @@
 msgid "add CWRelation relation_type CWRType object"
 msgstr "Definición de relación"
 
+msgid "add CWUniqueTogetherConstraint constraint_of CWEType object"
+msgstr ""
+
 msgid "add CWUser in_group CWGroup object"
 msgstr "Usuario"
 
@@ -1487,6 +1502,20 @@
 msgid "constraint factory"
 msgstr "Fábrica de restricciones"
 
+msgid "constraint_of"
+msgstr ""
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "constraint_of"
+msgstr ""
+
+msgid "constraint_of_object"
+msgstr ""
+
+msgctxt "CWEType"
+msgid "constraint_of_object"
+msgstr ""
+
 msgid "constraints"
 msgstr "Restricciones"
 
@@ -1619,6 +1648,11 @@
 msgid "creating CWRelation (CWRelation relation_type CWRType %(linkto)s)"
 msgstr "Creación de la relación %(linkto)s"
 
+msgid ""
+"creating CWUniqueTogetherConstraint (CWUniqueTogetherConstraint "
+"constraint_of CWEType %(linkto)s)"
+msgstr ""
+
 msgid "creating CWUser (CWUser in_group CWGroup %(linkto)s)"
 msgstr "Creación de un usuario para agregar al grupo %(linkto)s"
 
@@ -1873,6 +1907,9 @@
 msgid "define how we get out from a sub-workflow"
 msgstr "Define como salir de un sub-Workflow"
 
+msgid "defines a sql-level multicolumn unique index"
+msgstr ""
+
 msgid ""
 "defines what's the property is applied for. You must select this first to be "
 "able to set value"
@@ -3231,9 +3268,27 @@
 msgid "relation_type_object"
 msgstr "Definición de Relaciones"
 
+msgid "relations"
+msgstr ""
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "relations"
+msgstr ""
+
 msgid "relations deleted"
 msgstr "Relaciones Eliminadas"
 
+msgid "relations_object"
+msgstr ""
+
+msgctxt "CWAttribute"
+msgid "relations_object"
+msgstr ""
+
+msgctxt "CWRelation"
+msgid "relations_object"
+msgstr ""
+
 msgid "relative url of the bookmarked page"
 msgstr "Url relativa de la página"
 
@@ -4035,6 +4090,10 @@
 msgid "view_index"
 msgstr "Inicio"
 
+#, python-format
+msgid "violates unique_together constraints (%s)"
+msgstr ""
+
 msgid "visible"
 msgstr "Visible"
 
--- a/i18n/fr.po	Wed Sep 15 15:00:04 2010 +0200
+++ b/i18n/fr.po	Wed Sep 15 15:14:35 2010 +0200
@@ -4,7 +4,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: cubicweb 2.46.0\n"
-"PO-Revision-Date: 2010-09-06 21:44+0200\n"
+"PO-Revision-Date: 2010-09-15 15:12+0200\n"
 "Last-Translator: Logilab Team <contact@logilab.fr>\n"
 "Language-Team: fr <contact@logilab.fr>\n"
 "Language: \n"
@@ -37,7 +37,7 @@
 msgstr "  de l'état %(fromstate)s vers l'état %(tostate)s\n"
 
 msgid " :"
-msgstr ""
+msgstr " :"
 
 #, python-format
 msgid "%(attr)s set to %(newvalue)s"
@@ -324,6 +324,12 @@
 msgid "CWRelation_plural"
 msgstr "Relations"
 
+msgid "CWUniqueTogetherConstraint"
+msgstr "Contrainte unique_together"
+
+msgid "CWUniqueTogetherConstraint_plural"
+msgstr "Contraintes unique_together"
+
 msgid "CWUser"
 msgstr "Utilisateur"
 
@@ -515,6 +521,9 @@
 msgid "New CWRelation"
 msgstr "Nouvelle définition de relation non finale"
 
+msgid "New CWUniqueTogetherConstraint"
+msgstr "Nouvelle contrainte unique_together"
+
 msgid "New CWUser"
 msgstr "Nouvel utilisateur"
 
@@ -705,6 +714,9 @@
 msgid "This CWRelation"
 msgstr "Cette définition de relation"
 
+msgid "This CWUniqueTogetherConstraint"
+msgstr "Cette contrainte unique_together"
+
 msgid "This CWUser"
 msgstr "Cet utilisateur"
 
@@ -920,6 +932,9 @@
 msgid "add CWRelation relation_type CWRType object"
 msgstr "définition de relation"
 
+msgid "add CWUniqueTogetherConstraint constraint_of CWEType object"
+msgstr "contrainte unique_together"
+
 msgid "add CWUser in_group CWGroup object"
 msgstr "utilisateur"
 
@@ -1487,6 +1502,20 @@
 msgid "constraint factory"
 msgstr "fabrique de contraintes"
 
+msgid "constraint_of"
+msgstr "contrainte de"
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "constraint_of"
+msgstr "contrainte de"
+
+msgid "constraint_of_object"
+msgstr "contraint par"
+
+msgctxt "CWEType"
+msgid "constraint_of_object"
+msgstr "contraint par"
+
 msgid "constraints"
 msgstr "contraintes"
 
@@ -1546,7 +1575,9 @@
 msgstr "contexte où ce composant doit être affiché"
 
 msgid "context where this facet should be displayed, leave empty for both"
-msgstr "contexte où cette facette doit être affichée. Laissez ce champ vide pour l'avoir dans les deux."
+msgstr ""
+"contexte où cette facette doit être affichée. Laissez ce champ vide pour "
+"l'avoir dans les deux."
 
 msgid "control subject entity's relations order"
 msgstr "contrôle l'ordre des relations de l'entité sujet"
@@ -1619,6 +1650,11 @@
 msgid "creating CWRelation (CWRelation relation_type CWRType %(linkto)s)"
 msgstr "création relation %(linkto)s"
 
+msgid ""
+"creating CWUniqueTogetherConstraint (CWUniqueTogetherConstraint "
+"constraint_of CWEType %(linkto)s)"
+msgstr "création d'une contrainte unique_together sur %(linkto)s"
+
 msgid "creating CWUser (CWUser in_group CWGroup %(linkto)s)"
 msgstr "création d'un utilisateur à rajouter au groupe %(linkto)s"
 
@@ -1869,6 +1905,9 @@
 msgid "define how we get out from a sub-workflow"
 msgstr "définit comment sortir d'un sous-workflow"
 
+msgid "defines a sql-level multicolumn unique index"
+msgstr "définit un index SQL unique sur plusieurs colonnes"
+
 msgid ""
 "defines what's the property is applied for. You must select this first to be "
 "able to set value"
@@ -3229,9 +3268,27 @@
 msgid "relation_type_object"
 msgstr "définition"
 
+msgid "relations"
+msgstr "relations"
+
+msgctxt "CWUniqueTogetherConstraint"
+msgid "relations"
+msgstr "relations"
+
 msgid "relations deleted"
 msgstr "relations supprimées"
 
+msgid "relations_object"
+msgstr "relations de"
+
+msgctxt "CWAttribute"
+msgid "relations_object"
+msgstr "contraint par"
+
+msgctxt "CWRelation"
+msgid "relations_object"
+msgstr "contraint par"
+
 msgid "relative url of the bookmarked page"
 msgstr "url relative de la page"
 
@@ -4032,6 +4089,10 @@
 msgid "view_index"
 msgstr "accueil"
 
+#, python-format
+msgid "violates unique_together constraints (%s)"
+msgstr "violation de contrainte unique_together (%s)"
+
 msgid "visible"
 msgstr "visible"
 
--- a/server/sources/native.py	Wed Sep 15 15:00:04 2010 +0200
+++ b/server/sources/native.py	Wed Sep 15 15:14:35 2010 +0200
@@ -677,6 +677,11 @@
                         etype = elements[0]
                         rtypes = elements[1:]                        
                         raise UniqueTogetherError(etype, rtypes)
+                    mo = re.search('columns (.*) are not unique', arg)
+                    if mo is not None: # sqlite in use
+                        rtypes = [c.strip().lstrip('cw_') for c in mo.group(1).split(',')]
+                        etype = '???'
+                        raise UniqueTogetherError(etype, rtypes)
             raise
         return cursor