[cwuser, persistent properties] fix recent set_property implementation on CWUser: for_user is automatically handled for non-managers users (this is seriously debatable though)
--- a/entities/authobjs.py Mon Mar 28 16:41:36 2011 +0200
+++ b/entities/authobjs.py Mon Mar 28 16:42:46 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -87,8 +87,10 @@
'CWProperty X WHERE X pkey %(k)s, X for_user U, U eid %(u)s',
{'k': pkey, 'u': self.eid}).get_entity(0, 0)
except:
- self._cw.create_entity('CWProperty', pkey=unicode(pkey),
- value=value, for_user=self)
+ kwargs = dict(pkey=unicode(pkey), value=value)
+ if self.is_in_group('managers'):
+ kwargs['for_user'] = self
+ self._cw.create_entity('CWProperty', **kwargs)
else:
prop.set_attributes(value=value)