# HG changeset patch # User Sylvain Thénault # Date 1301323366 -7200 # Node ID e8b6fc55df2db013cfa07becfb243a1d0315b05f # Parent 8b29c4c2ffc6fcce13b3ddf90b669e30b519f08d [cwuser, persistent properties] fix recent set_property implementation on CWUser: for_user is automatically handled for non-managers users (this is seriously debatable though) diff -r 8b29c4c2ffc6 -r e8b6fc55df2d entities/authobjs.py --- 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)