[tests] make unittest_views_editforms pass again
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 24 Sep 2009 20:46:53 +0200
changeset 3467 a6405235aac6
parent 3466 beabe54a8664
child 3468 b02fa4db2868
[tests] make unittest_views_editforms pass again
web/views/formrenderers.py
web/views/forms.py
--- a/web/views/formrenderers.py	Thu Sep 24 20:40:20 2009 +0200
+++ b/web/views/formrenderers.py	Thu Sep 24 20:46:53 2009 +0200
@@ -341,7 +341,7 @@
             qeid = eid_param('eid', entity.eid)
             cbsetstate = "setCheckboxesState2('eid', %s, 'checked')" % \
                          xml_escape(dumps(entity.eid))
-            w(u'<tr class="%s">' % (entity.row % 2 and u'even' or u'odd'))
+            w(u'<tr class="%s">' % (entity.cw_row % 2 and u'even' or u'odd'))
             # XXX turn this into a widget used on the eid field
             w(u'<td>%s</td>' % checkbox('eid', entity.eid,
                                         checked=qeid in values))
--- a/web/views/forms.py	Thu Sep 24 20:40:20 2009 +0200
+++ b/web/views/forms.py	Thu Sep 24 20:46:53 2009 +0200
@@ -181,8 +181,8 @@
 
     def form_default_renderer(self):
         return self._cw.vreg['formrenderers'].select(self.form_renderer_id,
-                                                self._cw, rset=self.cw_rset,
-                                                row=self.cw_row, col=self.cw_col)
+                                                     self._cw, rset=self.cw_rset,
+                                                     row=self.cw_row, col=self.cw_col)
 
     def form_build_context(self, rendervalues=None):
         """build form context values (the .context attribute which is a
@@ -303,7 +303,7 @@
         msg = kwargs.pop('submitmsg', None)
         super(EntityFieldsForm, self).__init__(*args, **kwargs)
         if self.edited_entity is None:
-            self.edited_entity = self.complete_entity(self.cw_row or 0, self.cw_col or 0)
+            self.edited_entity = self.cw_rset.complete_entity(self.cw_row or 0, self.cw_col or 0)
         self.form_add_hidden('__type', eidparam=True)
         self.form_add_hidden('eid')
         if kwargs.get('mainform', True): # mainform default to true in parent
@@ -558,7 +558,7 @@
 class CompositeForm(FieldsForm):
     """form composed of sub-forms"""
     __regid__ = 'composite'
-    form_renderer_id = id
+    form_renderer_id = __regid__
 
     def __init__(self, *args, **kwargs):
         super(CompositeForm, self).__init__(*args, **kwargs)
@@ -573,7 +573,7 @@
 class CompositeEntityForm(EntityFieldsForm):
     """form composed of sub-forms"""
     __regid__ = 'composite'
-    form_renderer_id = id
+    form_renderer_id = __regid__
 
     def __init__(self, *args, **kwargs):
         super(CompositeEntityForm, self).__init__(*args, **kwargs)