entities/__init__.py
changeset 2613 5e19c2bb370e
parent 2459 d088d0ff48a1
child 2658 5535857eeaa5
equal deleted inserted replaced
2612:c3059d308dc2 2613:5e19c2bb370e
     7 """
     7 """
     8 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
     9 
     9 
    10 from warnings import warn
    10 from warnings import warn
    11 
    11 
    12 from logilab.common.deprecation import deprecated_function, obsolete
    12 from logilab.common.deprecation import deprecated
    13 from logilab.common.decorators import cached
    13 from logilab.common.decorators import cached
    14 
    14 
    15 from cubicweb import Unauthorized, typed_eid
    15 from cubicweb import Unauthorized, typed_eid
    16 from cubicweb.entity import Entity
    16 from cubicweb.entity import Entity
    17 from cubicweb.utils import dump_class
    17 from cubicweb.utils import dump_class
   237         else:
   237         else:
   238             tschema = rschema.subjects(cls.e_schema)[0]
   238             tschema = rschema.subjects(cls.e_schema)[0]
   239             wdg = widget(cls.vreg, tschema, rschema, cls, 'object')
   239             wdg = widget(cls.vreg, tschema, rschema, cls, 'object')
   240         return wdg
   240         return wdg
   241 
   241 
   242     @obsolete('use EntityFieldsForm.subject_relation_vocabulary')
   242     @deprecated('use EntityFieldsForm.subject_relation_vocabulary')
   243     def subject_relation_vocabulary(self, rtype, limit):
   243     def subject_relation_vocabulary(self, rtype, limit):
   244         form = self.vreg.select('forms', 'edition', self.req, entity=self)
   244         form = self.vreg.select('forms', 'edition', self.req, entity=self)
   245         return form.subject_relation_vocabulary(rtype, limit)
   245         return form.subject_relation_vocabulary(rtype, limit)
   246 
   246 
   247     @obsolete('use EntityFieldsForm.object_relation_vocabulary')
   247     @deprecated('use EntityFieldsForm.object_relation_vocabulary')
   248     def object_relation_vocabulary(self, rtype, limit):
   248     def object_relation_vocabulary(self, rtype, limit):
   249         form = self.vreg.select('forms', 'edition', self.req, entity=self)
   249         form = self.vreg.select('forms', 'edition', self.req, entity=self)
   250         return form.object_relation_vocabulary(rtype, limit)
   250         return form.object_relation_vocabulary(rtype, limit)
   251 
   251 
   252     @obsolete('use AutomaticEntityForm.[e]relations_by_category')
   252     @deprecated('use AutomaticEntityForm.[e]relations_by_category')
   253     def relations_by_category(self, categories=None, permission=None):
   253     def relations_by_category(self, categories=None, permission=None):
   254         from cubicweb.web.views.autoform import AutomaticEntityForm
   254         from cubicweb.web.views.autoform import AutomaticEntityForm
   255         return AutomaticEntityForm.erelations_by_category(self, categories, permission)
   255         return AutomaticEntityForm.erelations_by_category(self, categories, permission)
   256 
   256 
   257     @obsolete('use AutomaticEntityForm.[e]srelations_by_category')
   257     @deprecated('use AutomaticEntityForm.[e]srelations_by_category')
   258     def srelations_by_category(self, categories=None, permission=None):
   258     def srelations_by_category(self, categories=None, permission=None):
   259         from cubicweb.web.views.autoform import AutomaticEntityForm
   259         from cubicweb.web.views.autoform import AutomaticEntityForm
   260         return AutomaticEntityForm.esrelations_by_category(self, categories, permission)
   260         return AutomaticEntityForm.esrelations_by_category(self, categories, permission)
   261 
   261 
   262     def attribute_values(self, attrname):
   262     def attribute_values(self, attrname):