Author: croberts
Date: 2011-08-12 19:56:19 +0000 (Fri, 12 Aug 2011)
New Revision: 4923
Modified:
trunk/cumin/python/cumin/grid/tags.py
Log:
More tagging code cleanup, pydoc additions
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2011-08-12 15:25:19 UTC (rev 4922)
+++ trunk/cumin/python/cumin/grid/tags.py 2011-08-12 19:56:19 UTC (rev 4923)
@@ -326,6 +326,11 @@
return("Tag name(s): ")
class TagsList(CheckboxItemSetField):
+ '''
+ This class, note the rendering handled in tags.strings::filtered_select_html,
+ takes care of displaying the tags for the given node in a filterable select box
+ that is pageable.
+ '''
def __init__(self, app, name):
item_parameter = SymbolParameter(app, "tag")
super(RemoveTags.TagsList, self).__init__(app, name, item_parameter)
@@ -346,6 +351,10 @@
return tags_string
def do_get_items(self, session):
+ '''
+ Returns the tags returned from the wallaby call formatted as checkboxitems
+ (which are used as select options in this case)
+ '''
tags = fetchTags(self, session)
items = list()
@@ -412,7 +421,7 @@
such that when the user enters text, they will be greeted with
a set of tags that match their text entry, or "No matches"
- If we decide against this sort of interface, this class can be removed
+ **** If we decide against this sort of interface, this class can be removed
'''
def __init__(self, app, name, form, param):
super(TagSelectField, self).__init__(app, name)
@@ -493,9 +502,8 @@
class TagsList(CheckboxItemSetField):
'''
- This class, note the rendering handled in
tags.strings::double_filtered_select_html,
- takes care of displaying the tags for the given node in a filterable select box
with additions
- being moved to a second box.
+ This class takes care of displaying the tags for the given node in a filterable
select box
+ that is pageable. Note the rendering handled in
tags.strings::filtered_select_html
'''
def __init__(self, app, name):
item_parameter = SymbolParameter(app, "tag")
@@ -587,9 +595,13 @@
return value
def render_inputs(self, session, *args):
+ '''
+ Show the initial value passed-in, truncated to trunc_length characters
+ '''
+ trunc_length = 50
value = self.input.get(session)
- if(len(value) > 50):
- value = value[:50] + "..." #indicate truncated value
+ if(len(value) > trunc_length):
+ value = value[:trunc_length] + "..." #indicate truncated value
return value
class DisabledInput(StringInput):
@@ -667,7 +679,7 @@
return items
def render_title(self, session):
- return "Nodes"
+ return "Update nodes"
class NodeName(StringField):
def __init__(self, app, name):
@@ -686,8 +698,9 @@
def render_inputs(self, session, *args):
value = self.input.get(session)
- if(len(value) > 50):
- value = value[:50] + "..." #indicate truncated value
+ trunc_length = 50
+ if(len(value) > trunc_length):
+ value = value[:trunc_length] + "..." #indicate truncated value
return value
def render_title(self, session):
@@ -891,7 +904,7 @@
wallaby_tags = self.app.wallaby.get_data(WBTypes.TAGS)
tag_list = list()
- for i, tag in enumerate(wallaby_tags):
+ for tag in wallaby_tags:
tag_list.append(str(tag.name))
tag_list.sort()
@@ -904,7 +917,7 @@
wallaby_nodes = self.app.wallaby.get_data(WBTypes.NODES)
node_list = list()
- for i, node in enumerate(wallaby_nodes):
+ for node in wallaby_nodes:
node_list.append(str(node.name))
node_list.sort()