# HG changeset patch # User Sylvain Thénault # Date 1259653417 -3600 # Node ID 19aefd78f61b33bc21065a046bfa9b2fb5fe0966 # Parent fbd77bda27c1039deb80b0f22081623db59b6dbf [forms] deprecate form_render(**kwargs) in favor of render(formvalues=None, rendervalues=None, renderer=None) to fix a pitfall in form_render prototype: there is no way to distinguish between arguments that should be given to build_context from arguments that should be given to the renderer. This was problematic for instance with inlined form where a 'title' argument is given for the renderer, but is also used as default value for field whose name is 'title'... diff -r fbd77bda27c1 -r 19aefd78f61b web/test/unittest_form.py --- a/web/test/unittest_form.py Tue Dec 01 08:38:02 2009 +0100 +++ b/web/test/unittest_form.py Tue Dec 01 08:43:37 2009 +0100 @@ -95,7 +95,7 @@ self.req.form['__linkto'] = 'in_group:%s:subject' % geid form = self.vreg['forms'].select('edition', self.req, entity=e) form.content_type = 'text/html' - pageinfo = self._check_html(form.form_render(), form, template=None) + pageinfo = self._check_html(form.render(), form, template=None) inputs = pageinfo.find_tag('select', False) self.failUnless(any(attrs for t, attrs in inputs if attrs.get('name') == 'in_group:A')) inputs = pageinfo.find_tag('input', False) @@ -126,14 +126,14 @@ creation_date = DateTimeField(widget=DateTimePicker) form = CustomChangeStateForm(self.req, redirect_path='perdu.com', entity=self.entity) - form.form_render(state=123, trcomment=u'', - trcomment_format=u'text/plain') + form.render(formvalues=dict(state=123, trcomment=u'', + trcomment_format=u'text/plain')) def test_change_state_form(self): form = ChangeStateForm(self.req, redirect_path='perdu.com', entity=self.entity) - form.form_render(state=123, trcomment=u'', - trcomment_format=u'text/plain') + form.render(formvalues=dict(state=123, trcomment=u'', + trcomment_format=u'text/plain')) # fields tests ############################################################ diff -r fbd77bda27c1 -r 19aefd78f61b web/views/cwproperties.py --- a/web/views/cwproperties.py Tue Dec 01 08:38:02 2009 +0100 +++ b/web/views/cwproperties.py Tue Dec 01 08:43:37 2009 +0100 @@ -202,7 +202,7 @@ self.form_row(form, key, splitlabel) renderer = self.vreg['formrenderers'].select('cwproperties', self.req, display_progress_div=False) - return form.form_render(renderer=renderer) + return form.render(renderer=renderer) def form_row(self, form, key, splitlabel): entity = self.entity_for_key(key) diff -r fbd77bda27c1 -r 19aefd78f61b web/views/editforms.py --- a/web/views/editforms.py Tue Dec 01 08:38:02 2009 +0100 +++ b/web/views/editforms.py Tue Dec 01 08:43:37 2009 +0100 @@ -94,7 +94,7 @@ w(u'
  • %s
  • ' % tags.a(entity.view('textoutofcontext'), href=entity.absolute_url())) w(u'\n') - w(form.form_render()) + w(form.render()) class ClickAndEditFormView(FormViewMixIn, EntityView): @@ -203,7 +203,7 @@ u'onmouseover="removeElementClass(jQuery(\'#%s\'), \'hidden\')">' % (divid, divid, divid)) w(u'
    %s
    ' % (divid, value)) - w(form.form_render(renderer=renderer)) + w(form.render(renderer=renderer)) w(u'