entities/__init__.py
changeset 10612 84468b90e9c1
parent 10411 4ee15441f2eb
child 10675 e0db937f5add
equal deleted inserted replaced
10611:f4dec0cca9a1 10612:84468b90e9c1
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """base application's entities class implementation: `AnyEntity`"""
    18 """base application's entities class implementation: `AnyEntity`"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 
    21 
       
    22 from six import string_types
    22 
    23 
    23 from logilab.common.decorators import classproperty
    24 from logilab.common.decorators import classproperty
    24 
    25 
    25 from cubicweb import Unauthorized
    26 from cubicweb import Unauthorized
    26 from cubicweb.entity import Entity
    27 from cubicweb.entity import Entity
   132         """
   133         """
   133         if rtype is None:
   134         if rtype is None:
   134             return self.dc_title().lower()
   135             return self.dc_title().lower()
   135         value = self.cw_attr_value(rtype)
   136         value = self.cw_attr_value(rtype)
   136         # do not restrict to `unicode` because Bytes will return a `str` value
   137         # do not restrict to `unicode` because Bytes will return a `str` value
   137         if isinstance(value, basestring):
   138         if isinstance(value, string_types):
   138             return self.printable_value(rtype, format='text/plain').lower()
   139             return self.printable_value(rtype, format='text/plain').lower()
   139         return value
   140         return value
   140 
   141 
   141 
   142 
   142 def fetch_config(fetchattrs, mainattr=None, pclass=AnyEntity, order='ASC'):
   143 def fetch_config(fetchattrs, mainattr=None, pclass=AnyEntity, order='ASC'):