entity.py
changeset 2830 b0b26b029d08
parent 2829 054a8805da52
child 2831 ddde6cf856a1
equal deleted inserted replaced
2829:054a8805da52 2830:b0b26b029d08
   606             rql = '%s ORDERBY Z DESC WHERE X modification_date Z, %s' % args
   606             rql = '%s ORDERBY Z DESC WHERE X modification_date Z, %s' % args
   607         return rql
   607         return rql
   608 
   608 
   609     # generic vocabulary methods ##############################################
   609     # generic vocabulary methods ##############################################
   610 
   610 
   611     @deprecated('[3.4] see new form api')
       
   612     def vocabulary(self, rtype, role='subject', limit=None):
       
   613         """vocabulary functions must return a list of couples
       
   614         (label, eid) that will typically be used to fill the
       
   615         edition view's combobox.
       
   616 
       
   617         If `eid` is None in one of these couples, it should be
       
   618         interpreted as a separator in case vocabulary results are grouped
       
   619         """
       
   620         from logilab.common.testlib import mock_object
       
   621         form = self.vreg.select('forms', 'edition', self.req, entity=self)
       
   622         field = mock_object(name=rtype, role=role)
       
   623         return form.form_field_vocabulary(field, limit)
       
   624 
       
   625     def unrelated_rql(self, rtype, targettype, role, ordermethod=None,
   611     def unrelated_rql(self, rtype, targettype, role, ordermethod=None,
   626                       vocabconstraints=True):
   612                       vocabconstraints=True):
   627         """build a rql to fetch `targettype` entities unrelated to this entity
   613         """build a rql to fetch `targettype` entities unrelated to this entity
   628         using (rtype, role) relation
   614         using (rtype, role) relation
   629         """
   615         """