[ms / integrity] skip properties whose pkey starts with 'sources.' avoid validation error when setting last update time for instance
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Oct 2010 15:46:49 +0200
changeset 6628 7cf5d55cbb8a
parent 6627 430b7703b3fd
child 6629 edaa96d031b2
[ms / integrity] skip properties whose pkey starts with 'sources.' avoid validation error when setting last update time for instance
hooks/syncsession.py
--- a/hooks/syncsession.py	Mon Oct 25 15:44:37 2010 +0200
+++ b/hooks/syncsession.py	Mon Oct 25 15:46:49 2010 +0200
@@ -155,13 +155,15 @@
 
     def __call__(self):
         key, value = self.entity.pkey, self.entity.value
+        if key.startswith('sources.'):
+            return
         session = self._cw
         try:
             value = session.vreg.typed_value(key, value)
         except UnknownProperty:
             qname = role_name('pkey', 'subject')
-            raise ValidationError(self.entity.eid,
-                                  {qname: session._('unknown property key')})
+            msg = session._('unknown property key %s') % key
+            raise ValidationError(self.entity.eid, {qname: msg})
         except ValueError, ex:
             qname = role_name('value', 'subject')
             raise ValidationError(self.entity.eid,
@@ -182,6 +184,8 @@
                 'value' in entity.cw_edited):
             return
         key, value = entity.pkey, entity.value
+        if key.startswith('sources.'):
+            return
         session = self._cw
         try:
             value = session.vreg.typed_value(key, value)