r5786 - in trunk: cumin/python/cumin/grid wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-30 15:29:27 +0000 (Tue, 30 Jul 2013)
New Revision: 5786
Modified:
trunk/cumin/python/cumin/grid/tags.py
trunk/wooly/python/wooly/forms.py
Log:
For a separated list, also check each value for empty
svn merge -c 5785 svn+ssh://svn.fedorahosted.org/svn/cumin/branches/statusquo .
BZ966548 (mod)
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2013-07-30 15:27:18 UTC (rev 5785)
+++ trunk/cumin/python/cumin/grid/tags.py 2013-07-30 15:29:27 UTC (rev 5786)
@@ -519,6 +519,7 @@
self.tag = self.TagNamesField(app, "tag")
self.tag.required = True
+ self.tag.separator = ","
self.add_field(self.tag)
def process_submit(self, session):
Modified: trunk/wooly/python/wooly/forms.py
===================================================================
--- trunk/wooly/python/wooly/forms.py 2013-07-30 15:27:18 UTC (rev 5785)
+++ trunk/wooly/python/wooly/forms.py 2013-07-30 15:29:27 UTC (rev 5786)
@@ -139,6 +139,16 @@
title = self.widget.render_title(session)
return "The '%s' field must have a value" % title
+class MissingMultiValueError(FormError):
+ def __init__(self, widget):
+ super(MissingMultiValueError, self).__init__(widget)
+
+ self.widget = widget
+
+ def get_message(self, session):
+ title = self.widget.render_title(session)
+ return "Each listed value in the '%s' field must be non-empty" % title
+
class QuoteValueError(FormError):
def __init__(self, widget):
super(QuoteValueError, self).__init__(None)
@@ -489,7 +499,20 @@
self.input = StringInput(app, "input")
self.add_child(self.input)
+ self.separator = None
+ def validate(self, session):
+ super(StringField, self).validate(session)
+
+ if self.separator and isinstance(self.separator, str):
+ v = self.get(session)
+ if v:
+ for val in v.split(self.separator):
+ if not val:
+ error = MissingMultiValueError(self)
+ self.form.errors.add(session, error)
+ break
+
class NoXMLStringField(StringField):
def validate(self, session):
super(NoXMLStringField, self).validate(session)
10 years, 8 months
r5785 - in branches/statusquo: cumin/python/cumin/grid wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-30 15:27:18 +0000 (Tue, 30 Jul 2013)
New Revision: 5785
Modified:
branches/statusquo/cumin/python/cumin/grid/tags.py
branches/statusquo/wooly/python/wooly/forms.py
Log:
For a separated list, also check each value for empty
BZ966548 (mod)
Modified: branches/statusquo/cumin/python/cumin/grid/tags.py
===================================================================
--- branches/statusquo/cumin/python/cumin/grid/tags.py 2013-07-26 18:08:52 UTC (rev 5784)
+++ branches/statusquo/cumin/python/cumin/grid/tags.py 2013-07-30 15:27:18 UTC (rev 5785)
@@ -514,6 +514,7 @@
self.tag = self.TagNamesField(app, "tag")
self.tag.required = True
+ self.tag.separator = ","
self.add_field(self.tag)
def process_submit(self, session):
Modified: branches/statusquo/wooly/python/wooly/forms.py
===================================================================
--- branches/statusquo/wooly/python/wooly/forms.py 2013-07-26 18:08:52 UTC (rev 5784)
+++ branches/statusquo/wooly/python/wooly/forms.py 2013-07-30 15:27:18 UTC (rev 5785)
@@ -139,6 +139,16 @@
title = self.widget.render_title(session)
return "The '%s' field must have a value" % title
+class MissingMultiValueError(FormError):
+ def __init__(self, widget):
+ super(MissingMultiValueError, self).__init__(widget)
+
+ self.widget = widget
+
+ def get_message(self, session):
+ title = self.widget.render_title(session)
+ return "Each listed value in the '%s' field must be non-empty" % title
+
class QuoteValueError(FormError):
def __init__(self, widget):
super(QuoteValueError, self).__init__(None)
@@ -489,7 +499,20 @@
self.input = StringInput(app, "input")
self.add_child(self.input)
+ self.separator = None
+ def validate(self, session):
+ super(StringField, self).validate(session)
+
+ if self.separator and isinstance(self.separator, str):
+ v = self.get(session)
+ if v:
+ for val in v.split(self.separator):
+ if not val:
+ error = MissingMultiValueError(self)
+ self.form.errors.add(session, error)
+ break
+
class NoXMLStringField(StringField):
def validate(self, session):
super(NoXMLStringField, self).validate(session)
10 years, 8 months
r5784 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 18:08:52 +0000 (Fri, 26 Jul 2013)
New Revision: 5784
Modified:
trunk/cumin/python/cumin/grid/tags.py
Log:
Make tag name field required on create tags form.
Use standard exit_with_redirect.
svn merge -c 5781 svn+ssh://svn.fedorahosted.org/svn/cumin/branches/statusquo .
BZ966548
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2013-07-26 18:05:50 UTC (rev 5783)
+++ trunk/cumin/python/cumin/grid/tags.py 2013-07-26 18:08:52 UTC (rev 5784)
@@ -518,26 +518,24 @@
super(CreateTags, self).__init__(app, name, task, cls)
self.tag = self.TagNamesField(app, "tag")
+ self.tag.required = True
self.add_field(self.tag)
def process_submit(self, session):
tag = self.tag.get(session)
self.tag.validate(session)
if not self.errors.get(session):
- self.tag.set(session, tag)
-
+ self.tag.set(session, tag)
self.task.invoke(session, None, tag)
-
- url = self.return_url.get(session)
- self.page.redirect.set(session, url)
-
+ self.task.exit_with_redirect(session, None)
+
def render_tags_id(self, session):
return self.tag.input.path
def render_title(self, session):
return "Create a tag"
- class TagNamesField(StringField):
+ class TagNamesField(NoXMLStringField):
def __init__(self, app, name):
super(CreateTags.TagNamesField, self).__init__(app, name)
self.help = "*Comma separated list"
10 years, 8 months
r5783 - branches/statusquo/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 18:05:50 +0000 (Fri, 26 Jul 2013)
New Revision: 5783
Modified:
branches/statusquo/cumin/python/cumin/grid/tags.py
Log:
Make tag name field required on create tags form.
Use standard exit_with_redirect.
BZ966548
Modified: branches/statusquo/cumin/python/cumin/grid/tags.py
===================================================================
--- branches/statusquo/cumin/python/cumin/grid/tags.py 2013-07-26 16:10:37 UTC (rev 5782)
+++ branches/statusquo/cumin/python/cumin/grid/tags.py 2013-07-26 18:05:50 UTC (rev 5783)
@@ -513,26 +513,24 @@
super(CreateTags, self).__init__(app, name, task, cls)
self.tag = self.TagNamesField(app, "tag")
+ self.tag.required = True
self.add_field(self.tag)
def process_submit(self, session):
tag = self.tag.get(session)
self.tag.validate(session)
if not self.errors.get(session):
- self.tag.set(session, tag)
-
+ self.tag.set(session, tag)
self.task.invoke(session, None, tag)
-
- url = self.return_url.get(session)
- self.page.redirect.set(session, url)
-
+ self.task.exit_with_redirect(session, None)
+
def render_tags_id(self, session):
return self.tag.input.path
def render_title(self, session):
return "Create a tag"
- class TagNamesField(StringField):
+ class TagNamesField(NoXMLStringField):
def __init__(self, app, name):
super(CreateTags.TagNamesField, self).__init__(app, name)
self.help = "*Comma separated list"
10 years, 8 months
r5782 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 16:10:37 +0000 (Fri, 26 Jul 2013)
New Revision: 5782
Modified:
trunk/cumin/python/cumin/grid/pool.py
trunk/cumin/python/cumin/grid/slotvis.py
Log:
Promote slot table to tab level in slot vis.
svn merge -c 5781 svn+ssh://svn.fedorahosted.org/svn/cumin/branches/statusquo .
BZ964237
Modified: trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- trunk/cumin/python/cumin/grid/pool.py 2013-07-26 16:08:31 UTC (rev 5781)
+++ trunk/cumin/python/cumin/grid/pool.py 2013-07-26 16:10:37 UTC (rev 5782)
@@ -16,7 +16,7 @@
NegotiatorEditDynamicQuota
from limit import LimitFrame, LimitSelector
from cumin.grid.quota import QuotaSelector
-from cumin.grid.slotvis import SlotOverview
+from cumin.grid.slotvis import SlotSelector
from cumin.parameters import YoungestAttribute
strings = StringCatalog(__file__)
@@ -87,7 +87,7 @@
self.view.add_tab(submissions)
submissions.enable_csv_export()
- slots = SlotOverview(app, "slots")
+ slots = SlotSelector(app, "slots")
self.view.add_tab(slots)
schedulers = SchedulerSelector(app, "schedulers")
Modified: trunk/cumin/python/cumin/grid/slotvis.py
===================================================================
--- trunk/cumin/python/cumin/grid/slotvis.py 2013-07-26 16:08:31 UTC (rev 5781)
+++ trunk/cumin/python/cumin/grid/slotvis.py 2013-07-26 16:10:37 UTC (rev 5782)
@@ -15,15 +15,19 @@
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.slotvis")
-class SlotOverview(RadioModeSet):
- def __init__(self, app, name):
- super(SlotOverview, self).__init__(app, name)
+# Since the slot vis contains only the table
+# at this point, promote the table to the tab
+# level. Leave this here in case we add something back
- self.add_tab(SlotSelector(app, "slots"))
+#class SlotOverview(RadioModeSet):
+# def __init__(self, app, name):
+# super(SlotOverview, self).__init__(app, name)
+#
+# self.add_tab(SlotSelector(app, "slots"))
+#
+# def render_title(self, session):
+# return "Slots"
- def render_title(self, session):
- return "Slots"
-
class SlotSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_grid.Slot
@@ -53,8 +57,9 @@
# avoid the checkboxes
return SelectableSearchObjectTable(app, name, cls)
- def render_title(self, session):
- return "Slot table"
+# USe the default title if we're tab level
+# def render_title(self, session):
+# return "Slot table"
class SlotFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
def __init__(self, app, param):
10 years, 8 months
r5781 - branches/statusquo/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 16:08:31 +0000 (Fri, 26 Jul 2013)
New Revision: 5781
Modified:
branches/statusquo/cumin/python/cumin/grid/pool.py
branches/statusquo/cumin/python/cumin/grid/slotvis.py
Log:
Promote slot table to tab level in slot vis.
BZ964237
Modified: branches/statusquo/cumin/python/cumin/grid/pool.py
===================================================================
--- branches/statusquo/cumin/python/cumin/grid/pool.py 2013-07-26 15:47:19 UTC (rev 5780)
+++ branches/statusquo/cumin/python/cumin/grid/pool.py 2013-07-26 16:08:31 UTC (rev 5781)
@@ -16,7 +16,7 @@
NegotiatorEditDynamicQuota
from limit import LimitFrame, LimitSelector
from cumin.grid.quota import QuotaSelector
-from cumin.grid.slotvis import SlotOverview
+from cumin.grid.slotvis import SlotSelector
from cumin.parameters import YoungestAttribute
strings = StringCatalog(__file__)
@@ -86,7 +86,7 @@
submissions = PoolSubmissionJoinSelector(app, "pool_submissions")
self.view.add_tab(submissions)
- slots = SlotOverview(app, "slots")
+ slots = SlotSelector(app, "slots")
self.view.add_tab(slots)
schedulers = SchedulerSelector(app, "schedulers")
Modified: branches/statusquo/cumin/python/cumin/grid/slotvis.py
===================================================================
--- branches/statusquo/cumin/python/cumin/grid/slotvis.py 2013-07-26 15:47:19 UTC (rev 5780)
+++ branches/statusquo/cumin/python/cumin/grid/slotvis.py 2013-07-26 16:08:31 UTC (rev 5781)
@@ -15,15 +15,19 @@
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.slotvis")
-class SlotOverview(RadioModeSet):
- def __init__(self, app, name):
- super(SlotOverview, self).__init__(app, name)
+# Since the slot vis contains only the table
+# at this point, promote the table to the tab
+# level. Leave this here in case we add something back
- self.add_tab(SlotSelector(app, "slots"))
+#class SlotOverview(RadioModeSet):
+# def __init__(self, app, name):
+# super(SlotOverview, self).__init__(app, name)
+#
+# self.add_tab(SlotSelector(app, "slots"))
+#
+# def render_title(self, session):
+# return "Slots"
- def render_title(self, session):
- return "Slots"
-
class SlotSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_grid.Slot
@@ -53,8 +57,9 @@
# avoid the checkboxes
return SelectableSearchObjectTable(app, name, cls)
- def render_title(self, session):
- return "Slot table"
+# USe the default title if we're tab level
+# def render_title(self, session):
+# return "Slot table"
class SlotFieldOptions(SelectableSearchObjectTable.SearchFieldOptions):
def __init__(self, app, param):
10 years, 8 months
r5780 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 15:47:19 +0000 (Fri, 26 Jul 2013)
New Revision: 5780
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
Log:
Make negotiator tab title singular
svn merge -c 5779 svn+ssh://svn.fedorahosted.org/svn/cumin/branches/statusquo .
BZ964217
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2013-07-26 15:44:42 UTC (rev 5779)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2013-07-26 15:47:19 UTC (rev 5780)
@@ -53,6 +53,9 @@
self.enable_csv_export()
+ def render_title(self, session):
+ return "Negotiator"
+
def create_table(self, app, name, cls):
# avoid the checkboxes
return SelectableSearchObjectTable(app, name, cls)
10 years, 8 months
r5779 - branches/statusquo/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-26 15:44:42 +0000 (Fri, 26 Jul 2013)
New Revision: 5779
Modified:
branches/statusquo/cumin/python/cumin/grid/negotiator.py
Log:
Make negotiator tab title singular
BZ964217
Modified: branches/statusquo/cumin/python/cumin/grid/negotiator.py
===================================================================
--- branches/statusquo/cumin/python/cumin/grid/negotiator.py 2013-07-23 21:07:36 UTC (rev 5778)
+++ branches/statusquo/cumin/python/cumin/grid/negotiator.py 2013-07-26 15:44:42 UTC (rev 5779)
@@ -53,6 +53,9 @@
self.enable_csv_export()
+ def render_title(self, session):
+ return "Negotiator"
+
def create_table(self, app, name, cls):
# avoid the checkboxes
return SelectableSearchObjectTable(app, name, cls)
10 years, 8 months
r5778 - branches/statusquo/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-23 21:07:36 +0000 (Tue, 23 Jul 2013)
New Revision: 5778
Modified:
branches/statusquo/wooly/python/wooly/pages.py
Log:
Merge BZ980366 from trunk.
svn merge -c 5777 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
Modified: branches/statusquo/wooly/python/wooly/pages.py
===================================================================
--- branches/statusquo/wooly/python/wooly/pages.py 2013-07-05 15:58:27 UTC (rev 5777)
+++ branches/statusquo/wooly/python/wooly/pages.py 2013-07-23 21:07:36 UTC (rev 5778)
@@ -290,8 +290,11 @@
sess = self.session.get(session)
widgets = self.widgets.get(session)
-
+ already_done = []
for widget in widgets:
+ if widget in already_done:
+ continue
+ already_done.append(widget)
self.widget_tmpl.render(writer, sess, widget)
# If a widget generated a redirect url,
# there is no sense finishing the render
10 years, 9 months
r5777 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-07-05 15:58:27 +0000 (Fri, 05 Jul 2013)
New Revision: 5777
Modified:
trunk/wooly/python/wooly/pages.py
Log:
Partial fix for BZ980366. If a widget appears more than once in an update url request, only render the widget a single time in the response.
Modified: trunk/wooly/python/wooly/pages.py
===================================================================
--- trunk/wooly/python/wooly/pages.py 2013-07-01 17:21:08 UTC (rev 5776)
+++ trunk/wooly/python/wooly/pages.py 2013-07-05 15:58:27 UTC (rev 5777)
@@ -290,8 +290,11 @@
sess = self.session.get(session)
widgets = self.widgets.get(session)
-
+ already_done = []
for widget in widgets:
+ if widget in already_done:
+ continue
+ already_done.append(widget)
self.widget_tmpl.render(writer, sess, widget)
# If a widget generated a redirect url,
# there is no sense finishing the render
10 years, 9 months