Author: justi9
Date: 2009-12-21 09:52:26 -0500 (Mon, 21 Dec 2009)
New Revision: 3753
Modified:
mgmt/trunk/cumin/python/cumin/grid/submission.py
mgmt/trunk/wooly/python/wooly/forms.py
Log:
Add a 'folding' form widget with a showable extra field set; use it for the
submission add form
Modified: mgmt/trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-12-21 14:48:13 UTC (rev 3752)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-12-21 14:52:26 UTC (rev 3753)
@@ -108,7 +108,7 @@
def render_title(self, session):
return "Jobs"
-class SubmissionAddForm(FieldSubmitForm):
+class SubmissionAddForm(FoldingFieldSubmitForm):
def __init__(self, app, name, task):
super(SubmissionAddForm, self).__init__(app, name)
@@ -117,71 +117,61 @@
self.task = task
- self.content = Widget(app, "fields")
- self.add_child(self.content)
-
- self.main = FormFieldSet(app, "main")
- self.content.add_child(self.main)
-
- self.extra = ShowableFieldSet(app, "extra")
- self.content.add_child(self.extra)
-
from scheduler import SchedulerSelectField # XXX
self.scheduler = SchedulerSelectField(app, "scheduler", self.pool)
self.scheduler.required = True
self.scheduler.help = "Create submission at this scheduler"
- self.main.add_field(self.scheduler)
+ self.main_fields.add_field(self.scheduler)
self.description = self.DescriptionField(app, "description")
self.description.input.size = 50
self.description.required = True
self.description.help = "This text will identify the submission"
- self.main.add_field(self.description)
+ self.main_fields.add_field(self.description)
self.command = self.CommandField(app, "command")
self.command.input.columns = 50
self.command.required = True
self.command.help = "The path to the executable and any arguments"
- self.main.add_field(self.command)
+ self.main_fields.add_field(self.command)
self.requirements = self.RequirementsField(app, "requirements")
self.requirements.input.columns = 50
self.requirements.help = "Attributes controlling where and when " + \
"this submission will run"
-
- self.main.add_field(self.requirements)
+ self.main_fields.add_field(self.requirements)
self.directory = self.WorkingDirectoryField(app, "directory")
self.directory.input.size = 50
self.directory.help = "Run the process in this directory"
- self.extra.add_field(self.directory)
+ self.extra_fields.add_field(self.directory)
self.stdin = self.StdinField(app, "stdin")
self.stdin.input.size = 50
self.stdin.help = "Get process input from this file"
- self.extra.add_field(self.stdin)
+ self.extra_fields.add_field(self.stdin)
self.stdout = self.StdoutField(app, "stdout")
self.stdout.input.size = 50
self.stdout.help = "Send process output to this file"
- self.extra.add_field(self.stdout)
+ self.extra_fields.add_field(self.stdout)
self.stderr = self.StderrField(app, "stderr")
self.stderr.input.size = 50
self.stderr.help = "Send error output to this file"
- self.extra.add_field(self.stderr)
+ self.extra_fields.add_field(self.stderr)
#self.options = self.OptionsField(app, "options")
#self.main.add_field(self.options)
self.attributes_ = self.AttributesField(app, "attributes")
self.attributes_.input.columns = 50
- self.extra.add_field(self.attributes_)
+ self.extra_fields.add_field(self.attributes_)
def check(self, session):
- self.main.check(session)
- self.extra.check(session)
+ self.main_fields.check(session)
+ self.extra_fields.check(session)
def process_submit(self, session):
self.check(session)
Modified: mgmt/trunk/wooly/python/wooly/forms.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/forms.py 2009-12-21 14:48:13 UTC (rev 3752)
+++ mgmt/trunk/wooly/python/wooly/forms.py 2009-12-21 14:52:26 UTC (rev 3753)
@@ -470,8 +470,6 @@
self.error_display = FormErrorSet(app, "errors")
self.add_child(self.error_display)
- self.content = None
-
self.buttons = list()
def add_button(self, button):
@@ -485,7 +483,7 @@
return self.error_display.render(session, *args)
def render_content(self, session, *args):
- return self.content.render(session, *args)
+ raise Exception("Not implemented")
def render_buttons(self, session, *args):
writer = Writer()
@@ -576,3 +574,28 @@
super(FieldSubmitForm, self).check(session)
self.content.check(session)
+
+ def render_content(self, session, *args):
+ return self.content.render(session, *args)
+
+class FoldingFieldSubmitForm(SubmitForm):
+ def __init__(self, app, name):
+ super(FoldingFieldSubmitForm, self).__init__(app, name)
+
+ self.content = Widget(app, "fields")
+ self.add_child(self.content)
+
+ self.main_fields = FormFieldSet(app, "main")
+ self.content.add_child(self.main_fields)
+
+ self.extra_fields = ShowableFieldSet(app, "extra")
+ self.content.add_child(self.extra_fields)
+
+ def check(self, session):
+ super(FoldingFieldSubmitForm, self).check(session)
+
+ self.main.check(session)
+ self.extra.check(session)
+
+ def render_content(self, session, *args):
+ return self.content.render(session, *args)