entities/schemaobjs.py
branchstable
changeset 3353 1003a6f3d298
parent 2594 92aad5e18405
child 3377 dd9d292b6a6d
child 4212 ab6573088b4a
--- a/entities/schemaobjs.py	Mon Sep 21 18:49:38 2009 +0200
+++ b/entities/schemaobjs.py	Mon Sep 21 19:44:08 2009 +0200
@@ -63,14 +63,18 @@
         * raise ValidationError if inlining is'nt possible
         * eventually return True
         """
-        rtype = self.name
-        rschema = self.schema.rschema(rtype)
+        rschema = self.schema.rschema(self.name)
         if inlined == rschema.inlined:
             return False
         if inlined:
-            for (stype, otype) in rschema.iter_rdefs():
-                card = rschema.rproperty(stype, otype, 'cardinality')[0]
+            # don't use the persistent schema, we may miss cardinality changes
+            # in the same transaction
+            for rdef in self.reverse_relation_type:
+                card = rdef.cardinality[0]
                 if not card in '?1':
+                    rtype = self.name
+                    stype = rdef.stype
+                    otype = rdef.otype
                     msg = self.req._("can't set inlined=%(inlined)s, "
                                      "%(stype)s %(rtype)s %(otype)s "
                                      "has cardinality=%(card)s")