[schema serialization] for relation type, ertidx contains the relation type as string, for relation def, the RelationDefinitionSchema instance stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 17 Feb 2011 18:43:45 +0100
branchstable
changeset 7012 5ff6cb8bd2b3
parent 7011 f6ec6de03be6
child 7013 7e402e92caa6
child 7014 7e3e80f4179a
[schema serialization] for relation type, ertidx contains the relation type as string, for relation def, the RelationDefinitionSchema instance
server/schemaserial.py
--- a/server/schemaserial.py	Thu Feb 17 18:23:41 2011 +0100
+++ b/server/schemaserial.py	Thu Feb 17 18:43:45 2011 +0100
@@ -236,12 +236,12 @@
             eschema = schema.schema_by_eid(eeid)
             relations = unique_togethers.setdefault(uniquecstreid, (eschema, []))
             rel = ertidx[releid]
-            if isinstance(rel, schemamod.RelationSchema):
-                rtype = rel.type
-            else:
+            if isinstance(rel, schemamod.RelationDefinitionSchema):
                 # not yet migrated 3.9 database ('relations' target type changed
                 # to CWRType in 3.10)
                 rtype = rel.rtype.type
+            else:
+                rtype = str(rel)
             relations[1].append(rtype)
         for eschema, unique_together in unique_togethers.itervalues():
             eschema._unique_together.append(tuple(sorted(unique_together)))