restore limit on form_field_vocabulary, actually used tls-sprint
authorsylvain.thenault@logilab.fr
Tue, 10 Mar 2009 15:39:23 +0100
branchtls-sprint
changeset 1031 1a89683cb687
parent 1026 4c097dbaf560
child 1032 25ec009daa95
restore limit on form_field_vocabulary, actually used
entity.py
web/form.py
--- a/entity.py	Tue Mar 10 15:18:04 2009 +0100
+++ b/entity.py	Tue Mar 10 15:39:23 2009 +0100
@@ -802,7 +802,7 @@
         from logilab.common.testlib import mock_object
         form = EntityFieldsForm(self.req, entity=self)
         field = mock_object(name=rtype, role=role)
-        return form.form_field_vocabulary(field)
+        return form.form_field_vocabulary(field, limit)
             
     def unrelated_rql(self, rtype, targettype, role, ordermethod=None,
                       vocabconstraints=True):
--- a/web/form.py	Tue Mar 10 15:18:04 2009 +0100
+++ b/web/form.py	Tue Mar 10 15:39:23 2009 +0100
@@ -923,7 +923,7 @@
             return eid_param(field.id, self.entity.eid)
         return field.id
         
-    def form_field_vocabulary(self, field):
+    def form_field_vocabulary(self, field, limit=None):
         role, rtype = field.role, field.name
         try:
             vocabfunc = getattr(self.entity, '%s_%s_vocabulary' % (role, rtype))
@@ -938,7 +938,7 @@
         #       important because `vocabfunc` might return a list with
         #       couples (label, None) which act as separators. In these
         #       cases, it doesn't make sense to sort results afterwards.
-        return vocabfunc(rtype)
+        return vocabfunc(rtype, limit)
 ## XXX BACKPORT ME
 ##         if self.sort:
 ##             choices = sorted(choices)