[3.10] more form api update
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Oct 2010 17:15:55 +0200
changeset 6637 6bbfc628555b
parent 6636 dbc9cce53c11
child 6638 404aff81236c
[3.10] more form api update
web/test/unittest_form.py
web/views/massmailing.py
--- a/web/test/unittest_form.py	Mon Oct 25 17:15:54 2010 +0200
+++ b/web/test/unittest_form.py	Mon Oct 25 17:15:55 2010 +0200
@@ -143,7 +143,7 @@
         state.eid = 'S'
         form = RTFForm(self.req, redirect_path='perdu.com', entity=state)
         # make it think it can use fck editor anyway
-        form.field_by_name('description', 'subject').format = lambda x: 'text/html'
+        form.field_by_name('description', 'subject').format = lambda form, field=None: 'text/html'
         self.assertMultiLineEqual(self._render_entity_field('description', form),
                               expected % {'eid': state.eid})
 
--- a/web/views/massmailing.py	Mon Oct 25 17:15:54 2010 +0200
+++ b/web/views/massmailing.py	Mon Oct 25 17:15:55 2010 +0200
@@ -65,13 +65,13 @@
 
     sender = ff.StringField(widget=TextInput({'disabled': 'disabled'}),
                             label=_('From:'),
-                            value=lambda f: '%s <%s>' % (
-                                f._cw.user.dc_title(),
-                                f._cw.user.cw_adapt_to('IEmailable').get_email()))
+                            value=lambda form, field: '%s <%s>' % (
+                                form._cw.user.dc_title(),
+                                form._cw.user.cw_adapt_to('IEmailable').get_email()))
     recipient = ff.StringField(widget=CheckBox(), label=_('Recipients:'),
                                choices=recipient_vocabulary,
-                               value= lambda f: [entity.eid for entity in f.cw_rset.entities()
-                                                 if entity.cw_adapt_to('IEmailable').get_email()])
+                               value= lambda form, field: [entity.eid for entity in form.cw_rset.entities()
+                                                           if entity.cw_adapt_to('IEmailable').get_email()])
     subject = ff.StringField(label=_('Subject:'), max_length=256)
     mailbody = ff.StringField(widget=AjaxWidget(wdgtype='TemplateTextField',
                                                 inputid='mailbody'))
@@ -146,7 +146,7 @@
     def call(self):
         form = self._cw.vreg['forms'].select('massmailing', self._cw,
                                              rset=self.cw_rset)
-        self.w(form.render())
+        form.render(w=self.w)
 
 
 class SendMailController(controller.Controller):