field's help may now be a callable taking the form as argument stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 10 Jun 2009 18:44:10 +0200
branchstable
changeset 2093 e3aaf61f8c66
parent 2092 f5102472243d
child 2094 59a4e9f4f57a
field's help may now be a callable taking the form as argument
web/views/formrenderers.py
--- a/web/views/formrenderers.py	Wed Jun 10 16:13:29 2009 +0200
+++ b/web/views/formrenderers.py	Wed Jun 10 18:44:10 2009 +0200
@@ -94,6 +94,8 @@
     def render_help(self, form, field):
         help = []
         descr = field.help
+        if callable(descr):
+            descr = descr(form)
         if descr:
             help.append('<div class="helper">%s</div>' % self.req._(descr))
         example = field.example_format(self.req)