EntityFieldsForm.form_render() doesn't need entity anymore tls-sprint
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 20 Feb 2009 00:05:57 +0100
branchtls-sprint
changeset 874 90d98d80af82
parent 873 3d9df99b0bfa
child 875 dd83bd56deae
EntityFieldsForm.form_render() doesn't need entity anymore
web/form.py
web/views/baseforms.py
--- a/web/form.py	Thu Feb 19 23:32:51 2009 +0100
+++ b/web/form.py	Fri Feb 20 00:05:57 2009 +0100
@@ -407,7 +407,6 @@
     def render(self, form):
         return self.widget.render(form, self)
 
-
 class StringField(Field):
     def __init__(self, max_length=None, **kwargs):
         super(StringField, self).__init__(**kwargs)
@@ -590,9 +589,8 @@
         self.form_add_hidden('__type')
         self.form_add_hidden('eid', eidparam=False)
         
-    def form_render(self, entity, **values):
-        self.form_add_entity_hiddens(entity.e_schema)
-        self.entity = entity
+    def form_render(self, **values):
+        self.form_add_entity_hiddens(self.entity.e_schema)
         return super(EntityFieldsForm, self).form_render(**values)
 
     def form_add_entity_hiddens(self, eschema):
--- a/web/views/baseforms.py	Thu Feb 19 23:32:51 2009 +0100
+++ b/web/views/baseforms.py	Fri Feb 20 00:05:57 2009 +0100
@@ -104,13 +104,13 @@
             'st1': _(state.name),
             'st2': _(dest.name)}
         self.w(u'<p>%s</p>\n' % msg)
-        form = ChangeStateForm(redirect_path=self.redirectpath(entity)) # self.vreg.select_form('changestateform')
-        self.w(form.form_render(req, entity, state=dest.eid))
+        form = ChangeStateForm(req, entity=entity,
+                               redirect_path=self.redirectpath(entity))
+        self.w(form.form_render(entity, state=dest.eid))
 
     def redirectpath(self, entity):
         return entity.rest_path()
 
-
 class ClickAndEditForm(FormMixIn, EntityView):
     id = 'reledit'
     __select__ = match_kwargs('rtype')