--- a/entity.py Wed Sep 16 14:32:13 2009 +0200
+++ b/entity.py Wed Sep 16 14:32:56 2009 +0200
@@ -84,6 +84,7 @@
except AttributeError:
continue
+
class _metaentity(type):
"""this metaclass sets the relation tags on the entity class
and deals with the `widgets` attribute
@@ -721,20 +722,6 @@
# generic vocabulary methods ##############################################
- @deprecated('see new form api')
- def vocabulary(self, rtype, role='subject', limit=None):
- """vocabulary functions must return a list of couples
- (label, eid) that will typically be used to fill the
- edition view's combobox.
-
- If `eid` is None in one of these couples, it should be
- interpreted as a separator in case vocabulary results are grouped
- """
- from logilab.common.testlib import mock_object
- form = self.vreg.select('forms', 'edition', self.req, entity=self)
- field = mock_object(name=rtype, role=role)
- return form.form_field_vocabulary(field, limit)
-
def unrelated_rql(self, rtype, targettype, role, ordermethod=None,
vocabconstraints=True):
"""build a rql to fetch `targettype` entities unrelated to this entity
@@ -803,7 +790,7 @@
if limit is not None:
before, after = rql.split(' WHERE ', 1)
rql = '%s LIMIT %s WHERE %s' % (before, limit, after)
- return self.req.execute(rql, args, tuple(args.keys()))
+ return self.req.execute(rql, args, tuple(args))
# relations cache handling ################################################
@@ -959,6 +946,20 @@
words += entity.get_words()
return words
+ @deprecated('[3.2] see new form api')
+ def vocabulary(self, rtype, role='subject', limit=None):
+ """vocabulary functions must return a list of couples
+ (label, eid) that will typically be used to fill the
+ edition view's combobox.
+
+ If `eid` is None in one of these couples, it should be
+ interpreted as a separator in case vocabulary results are grouped
+ """
+ from logilab.common.testlib import mock_object
+ form = self.vreg.select('forms', 'edition', self.req, entity=self)
+ field = mock_object(name=rtype, role=role)
+ return form.form_field_vocabulary(field, limit)
+
# attribute and relation descriptors ##########################################