cubicweb/entities/authobjs.py
changeset 11352 7844973fe3e0
parent 11350 de466349b742
child 11699 b48020a80dc3
equal deleted inserted replaced
11351:97882e99138d 11352:7844973fe3e0
   113         try:
   113         try:
   114             prop = self._cw.execute(
   114             prop = self._cw.execute(
   115                 'CWProperty X WHERE X pkey %(k)s, X for_user U, U eid %(u)s',
   115                 'CWProperty X WHERE X pkey %(k)s, X for_user U, U eid %(u)s',
   116                 {'k': pkey, 'u': self.eid}).get_entity(0, 0)
   116                 {'k': pkey, 'u': self.eid}).get_entity(0, 0)
   117         except Exception:
   117         except Exception:
   118             kwargs = dict(pkey=unicode(pkey), value=value)
   118             kwargs = dict(pkey=text_type(pkey), value=value)
   119             if self.is_in_group('managers'):
   119             if self.is_in_group('managers'):
   120                 kwargs['for_user'] = self
   120                 kwargs['for_user'] = self
   121             self._cw.create_entity('CWProperty', **kwargs)
   121             self._cw.create_entity('CWProperty', **kwargs)
   122         else:
   122         else:
   123             prop.cw_set(value=value)
   123             prop.cw_set(value=value)