[server] don't try to set perms twice on the same relation (e.g. symetric relations)
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Mon, 07 Dec 2009 17:57:19 +0100
changeset 4010 b2d0b14a365d
parent 4009 fa4189f2cf98
child 4011 394f853bb653
child 4020 65ee20fb9078
[server] don't try to set perms twice on the same relation (e.g. symetric relations)
server/schemaserial.py
--- a/server/schemaserial.py	Mon Dec 07 17:17:22 2009 +0100
+++ b/server/schemaserial.py	Mon Dec 07 17:57:19 2009 +0100
@@ -202,7 +202,9 @@
                                   internationalizable=i18n,
                                   default=default, eid=rdefeid)
         rdefs = schema.add_relation_def(rdef)
-        set_perms(rdefs, permsdict.get(rdefeid, {}))
+        # rdefs can be None on duplicated relation definitions (e.g. symetrics)
+        if rdefs:
+            set_perms(rdefs, permsdict.get(rdefeid, {}))
     for values in session.execute(
         'Any X,SE,RT,OE,CARD,ORD,DESC,C WHERE X is CWRelation, X relation_type RT,'
         'X cardinality CARD, X ordernum ORD, X description DESC, '
@@ -217,7 +219,9 @@
                                   composite=c, constraints=constraints,
                                   eid=rdefeid)
         rdefs = schema.add_relation_def(rdef)
-        set_perms(rdefs, permsdict.get(rdefeid, {}))
+        # rdefs can be None on duplicated relation definitions (e.g. symetrics)
+        if rdefs:
+            set_perms(rdefs, permsdict.get(rdefeid, {}))
     schema.infer_specialization_rules()
     if _3_2_migration:
         _update_database(schema, sqlcu)