[yams] on creation, specify relations anyway so we don't get spurious warning for accessing eid through the dict api on yams validation stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Mar 2010 11:00:51 +0100
branchstable
changeset 4988 d85f639e9150
parent 4987 ec93dd82c83f
child 4989 0e6dca27422c
[yams] on creation, specify relations anyway so we don't get spurious warning for accessing eid through the dict api on yams validation
entity.py
--- a/entity.py	Wed Mar 24 11:00:02 2010 +0100
+++ b/entity.py	Wed Mar 24 11:00:51 2010 +0100
@@ -901,13 +901,16 @@
             _ = unicode
         else:
             _ = self._cw._
-        if creation or not hasattr(self, 'edited_attributes'):
+        if creation:
             # on creations, we want to check all relations, especially
             # required attributes
-            relations = None
-        else:
+            relations = [rschema for rschema in self.e_schema.subject_relations()
+                         if rschema.final and rschema.type != 'eid']
+        elif hasattr(self, 'edited_attributes'):
             relations = [self._cw.vreg.schema.rschema(rtype)
                          for rtype in self.edited_attributes]
+        else:
+            relations = None
         self.e_schema.check(self, creation=creation, _=_,
                             relations=relations)