cubicweb/entities/authobjs.py
changeset 11350 de466349b742
parent 11349 865de6759a53
child 11352 7844973fe3e0
equal deleted inserted replaced
11349:865de6759a53 11350:de466349b742
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """entity classes user and group entities"""
    18 """entity classes user and group entities"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 
    21 
    22 from six import string_types
    22 from six import string_types, text_type
    23 
    23 
    24 from logilab.common.decorators import cached
    24 from logilab.common.decorators import cached
    25 
    25 
    26 from cubicweb import Unauthorized
    26 from cubicweb import Unauthorized
    27 from cubicweb.entities import AnyEntity, fetch_config
    27 from cubicweb.entities import AnyEntity, fetch_config
   107             self.warning('incorrect value for eproperty %s of user %s',
   107             self.warning('incorrect value for eproperty %s of user %s',
   108                          key, self.login)
   108                          key, self.login)
   109         return self._cw.vreg.property_value(key)
   109         return self._cw.vreg.property_value(key)
   110 
   110 
   111     def set_property(self, pkey, value):
   111     def set_property(self, pkey, value):
   112         value = unicode(value)
   112         value = text_type(value)
   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: