entities/__init__.py
branchstable
changeset 9350 480600497e2d
parent 8930 6a02be304486
child 10019 c4a5865989ee
equal deleted inserted replaced
9349:2519f8536b45 9350:480600497e2d
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    31     instances have access to their issuing cursor
    31     instances have access to their issuing cursor
    32     """
    32     """
    33     __regid__ = 'Any'
    33     __regid__ = 'Any'
    34     __implements__ = ()
    34     __implements__ = ()
    35 
    35 
       
    36     @classproperty
       
    37     def cw_etype(cls):
       
    38         """entity type as a string"""
       
    39         return cls.__regid__
       
    40 
    36     @classmethod
    41     @classmethod
    37     def cw_create_url(cls, req, **kwargs):
    42     def cw_create_url(cls, req, **kwargs):
    38         """ 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"""
    39         return req.build_url('add/%s' % cls.__regid__, **kwargs)
    44         return req.build_url('add/%s' % cls.__regid__, **kwargs)
    40 
    45 
    55             selected.append(varname)
    60             selected.append(varname)
    56         return ['Any %s WHERE %s' % (', '.join(selected),
    61         return ['Any %s WHERE %s' % (', '.join(selected),
    57                                      ', '.join(restrictions))]
    62                                      ', '.join(restrictions))]
    58 
    63 
    59     # meta data api ###########################################################
    64     # meta data api ###########################################################
    60 
       
    61     @classproperty
       
    62     def cw_etype(self):
       
    63         """entity Etype as a string"""
       
    64         return self.__regid__
       
    65 
    65 
    66     def dc_title(self):
    66     def dc_title(self):
    67         """return a suitable *unicode* title for this entity"""
    67         """return a suitable *unicode* title for this entity"""
    68         for rschema, attrschema in self.e_schema.attribute_definitions():
    68         for rschema, attrschema in self.e_schema.attribute_definitions():
    69             if rschema.meta:
    69             if rschema.meta: