equal
deleted
inserted
replaced
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 from six import text_type, string_types |
23 |
23 |
24 from logilab.common.decorators import classproperty |
24 from logilab.common.decorators import classproperty |
25 |
25 |
26 from cubicweb import Unauthorized |
26 from cubicweb import Unauthorized |
27 from cubicweb.entity import Entity |
27 from cubicweb.entity import Entity |
34 __regid__ = 'Any' |
34 __regid__ = 'Any' |
35 |
35 |
36 @classproperty |
36 @classproperty |
37 def cw_etype(cls): |
37 def cw_etype(cls): |
38 """entity type as a unicode string""" |
38 """entity type as a unicode string""" |
39 return unicode(cls.__regid__) |
39 return text_type(cls.__regid__) |
40 |
40 |
41 @classmethod |
41 @classmethod |
42 def cw_create_url(cls, req, **kwargs): |
42 def cw_create_url(cls, req, **kwargs): |
43 """ return the url of the entity creation form for this entity type""" |
43 """ return the url of the entity creation form for this entity type""" |
44 return req.build_url('add/%s' % cls.__regid__, **kwargs) |
44 return req.build_url('add/%s' % cls.__regid__, **kwargs) |