Author: justi9
Date: 2008-09-12 16:13:25 -0400 (Fri, 12 Sep 2008)
New Revision: 2468
Modified:
mgmt/trunk/cumin/python/cumin/brokercluster.py
mgmt/trunk/cumin/python/cumin/brokerprofile.py
mgmt/trunk/cumin/python/wooly/__init__.py
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/forms.strings
mgmt/trunk/misc/boneyard.py
Log:
Replace TextInput with ScalarInput, and fix up some duplicate logic. An old todo item.
Modified: mgmt/trunk/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-09-12 20:13:25 UTC (rev 2468)
@@ -103,7 +103,7 @@
def __init__(self, app, name):
super(BrokerClusterForm, self).__init__(app, name)
- self.cluster_name = TextInput(app, "name", self)
+ self.cluster_name = StringInput(app, "name", self)
self.add_child(self.cluster_name)
def process_cluster(self, session, cluster):
Modified: mgmt/trunk/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-09-12 20:13:25 UTC (rev 2468)
@@ -104,7 +104,7 @@
def __init__(self, app, name):
super(BrokerProfileForm, self).__init__(app, name)
- self.profile_name = TextInput(app, "name", self)
+ self.profile_name = StringInput(app, "name", self)
self.add_child(self.profile_name)
def process_profile(self, session, profile):
Modified: mgmt/trunk/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/__init__.py 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/cumin/python/wooly/__init__.py 2008-09-12 20:13:25 UTC (rev 2468)
@@ -149,6 +149,7 @@
def add_child(self, child):
assert not self.sealed
+ assert child is not self
self.children.append(child)
self.children_by_name[child.name] = child
child.parent = self
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-09-12 20:13:25 UTC (rev 2468)
@@ -130,16 +130,10 @@
super(EmptyInputError, self).__init__(message)
-# XXX rename to ScalarInput. it's less confusing v-a-v StringInput
-class TextInput(FormInput):
+class ScalarInput(FormInput):
def __init__(self, app, name, form):
- super(TextInput, self).__init__(app, name, form)
+ super(ScalarInput, self).__init__(app, name, form)
- # XXX remove this once we move clients of this class to
- # StringInput
- self.set_parameter(Parameter(app, "param"))
- self.add_parameter(self.get_parameter())
-
self.size = 32
def set_size(self, size):
@@ -148,7 +142,7 @@
def render_size(self, session, *args):
return self.size
-class StringInput(TextInput):
+class StringInput(ScalarInput):
def __init__(self, app, name, form):
super(StringInput, self).__init__(app, name, form)
@@ -157,7 +151,7 @@
self.set_size(30)
-class IntegerInput(TextInput):
+class IntegerInput(ScalarInput):
def __init__(self, app, name, form):
super(IntegerInput, self).__init__(app, name, form)
@@ -348,7 +342,7 @@
def __init__(self, app, name, form):
super(StringField, self).__init__(app, name, form)
- input = TextInput(app, "input", form)
+ input = StringInput(app, "input", form)
self.add_child(input)
self.set_input(input)
Modified: mgmt/trunk/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.strings 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/cumin/python/wooly/forms.strings 2008-09-12 20:13:25 UTC (rev 2468)
@@ -1,7 +1,7 @@
[FormButton.html]
<button class="{class}" id="{id}" type="submit"
name="{name}" value="{value}" tabindex="{tab_index}"
{disabled_attr}>{content}</button>
-[TextInput.html]
+[ScalarInput.html]
<input type="text" name="{name}" value="{value}"
tabindex="{tab_index}" {disabled_attr} size="{size}"/>
[CheckboxInput.html]
Modified: mgmt/trunk/misc/boneyard.py
===================================================================
--- mgmt/trunk/misc/boneyard.py 2008-09-12 19:52:46 UTC (rev 2467)
+++ mgmt/trunk/misc/boneyard.py 2008-09-12 20:13:25 UTC (rev 2468)
@@ -158,7 +158,7 @@
self.profile.set_value("profile")
self.add_child(self.profile)
- self.pvalue = TextInput(app, "profile_value", self)
+ self.pvalue = StringInput(app, "profile_value", self)
self.pvalue.set_disabled(True)
self.add_child(self.pvalue)
@@ -167,7 +167,7 @@
self.broker.set_value("broker")
self.add_child(self.broker)
- self.svalue = TextInput(app, "broker_value", self)
+ self.svalue = StringInput(app, "broker_value", self)
self.svalue.set_disabled(True)
self.add_child(self.svalue)
@@ -176,7 +176,7 @@
self.local.set_value("local")
self.add_child(self.local)
- self.lvalue = TextInput(app, "local_value", self)
+ self.lvalue = StringInput(app, "local_value", self)
self.add_child(self.lvalue)
def render_title(self, session, prop):