fix some warnings
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 21 Oct 2010 20:02:33 +0200
changeset 717 8f4bbf01b25d
parent 716 448d9fb3ae71
child 718 12e2e2dc55c4
fix some warnings
views/primary.py
--- a/views/primary.py	Thu Oct 21 18:01:10 2010 +0200
+++ b/views/primary.py	Thu Oct 21 20:02:33 2010 +0200
@@ -186,7 +186,7 @@
                     except NoSelectableObject:
                         self.w(u'&#160;')
                     else:
-                        self.w(form.render())
+                        form.render(w=self.w)
                 else:
                     self.w(iwf.printable_state)
             self.w(u'</td></tr>')
@@ -287,7 +287,7 @@
                       6: 'icon'})
 
 
-def available_branches(form, field):
+def _available_branches(form, field):
     tc = form.edited_entity
     environment = form.cw_extra_kwargs['environment']
     # if branch specified on the environment, don't let other choices
@@ -298,7 +298,7 @@
         return environment.repository.branches()
     return [tc.apycot_configuration().get('branch')]
 
-def default_branch(form):
+def _default_branch(form, field):
     tc = form.edited_entity
     environment = form.cw_extra_kwargs['environment']
     cfg = tc.apycot_configuration(environment)
@@ -308,6 +308,12 @@
         return environment.repository.default_branch()
     return None
 
+def _using_environment_value(form, field):
+    return unicode(form.cw_extra_kwargs['environment'].eid)
+
+def _startrevdeps_value(form, field):
+    return form.edited_entity.start_reverse_dependencies and u'1' or u''
+
 class TCStartForm(forms.EntityFieldsForm):
     __regid__ = 'apycot.starttestform'
     __select__ = (match_user_groups('managers', 'staff')
@@ -323,11 +329,11 @@
                                                vid='narval.startplan')
 
     using_environment = ff.StringField(widget=fwdgs.HiddenInput(),
-                                       value=lambda form: form.cw_extra_kwargs['environment'].eid)
-    branch = ff.StringField(choices=available_branches, label=_('vcs_branch'),
-                            value=default_branch)
+                                       value=_using_environment_value)
+    branch = ff.StringField(choices=_available_branches, label=_('vcs_branch'),
+                            value=_default_branch)
     startrevdeps = ff.BooleanField(label=_('start_rev_deps'),
-                                   value=lambda form: form.edited_entity.start_reverse_dependencies and '1' or '')
+                                   value=_startrevdeps_value)
     archivetestdir = ff.BooleanField(label=_('archivetestdir'), value='')
     priority = ff.IntField(choices=[(label, str(val))
                                     for label, val in PRIORITY.items()],