Author: justi9
Date: 2008-10-03 09:27:39 -0400 (Fri, 03 Oct 2008)
New Revision: 2585
Modified:
mgmt/trunk/cumin/python/cumin/binding.py
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/brokercluster.py
mgmt/trunk/cumin/python/cumin/brokergroup.py
mgmt/trunk/cumin/python/cumin/brokerlink.py
mgmt/trunk/cumin/python/cumin/brokerprofile.py
mgmt/trunk/cumin/python/cumin/client.py
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/limits.py
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/realm.py
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/user.py
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/wooly/__init__.py
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/misc/boneyard.py
Log:
A pretty big API change:
- No longer require form be passed to all form inputs. We can
compute that another way.
- No longer any need to also call add_form_parameter for params in
forms.
- FormInput decorates a parameter, and its interface now reflects
that.
- set_parameter and get_parameter on FormInput are removed in favor
of using an attr directly: FormInput.param.
Modified: mgmt/trunk/cumin/python/cumin/binding.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/binding.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/binding.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -2,16 +2,16 @@
from cumin.util import sorted_by
from cumin.widgets import StateSwitch
from formats import *
-from wooly import Template, Writer, Attribute, Parameter
+from wooly import Template, Writer, Attribute, Parameter, Widget
from wooly.forms import FormInput, FormField
from wooly.parameters import DictParameter
from wooly.resources import StringCatalog
strings = StringCatalog(__file__)
-class ExchangeInput(FormInput):
- def __init__(self, app, name, form):
- super(ExchangeInput, self).__init__(app, name, form)
+class ExchangeInput(Widget):
+ def __init__(self, app, name):
+ super(ExchangeInput, self).__init__(app, name)
self.exchange = None
self.instance_data = None
@@ -92,8 +92,8 @@
pass
class BindingKeyExchangeInput(ExchangeInput):
- def __init__(self, app, name, form):
- super(BindingKeyExchangeInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(BindingKeyExchangeInput, self).__init__(app, name)
def render_key_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "key"))
@@ -111,8 +111,8 @@
pass
class XMLExchangeInput(BindingKeyExchangeInput):
- def __init__(self, app, name, form):
- super(XMLExchangeInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(XMLExchangeInput, self).__init__(app, name)
def render_xquery_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "xquery"))
@@ -142,8 +142,8 @@
arguments["xquery"] = this_exchange["xquery"]
class HeadersExchangeInput(BindingKeyExchangeInput):
- def __init__(self, app, name, form):
- super(HeadersExchangeInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(HeadersExchangeInput, self).__init__(app, name)
def render_x_match_path(self, session, exchange):
return DictParameter.sep().join((self.instance_data, "x-match"))
@@ -246,30 +246,28 @@
return self.get(session) == "c"
class ExchangeKeysField(FormField):
- def __init__(self, app, name, form, title="Initial bindings:"):
- super(ExchangeKeysField, self).__init__(app, name, form)
+ def __init__(self, app, name, title="Initial bindings:"):
+ super(ExchangeKeysField, self).__init__(app, name)
self.dict_param = DictParameter(app, "exchange")
self.add_parameter(self.dict_param)
- form.add_form_parameter(self.dict_param)
self.phase = Parameter(app, "phase")
self.add_parameter(self.phase)
- form.add_form_parameter(self.phase)
- self.direct_input = DirectExchangeInput(app, "direct", form)
+ self.direct_input = DirectExchangeInput(app, "direct")
self.add_child(self.direct_input)
- self.topic_input = TopicExchangeInput(app, "topic", form)
+ self.topic_input = TopicExchangeInput(app, "topic")
self.add_child(self.topic_input)
- self.fanout_input = FanoutExchangeInput(app, "fanout", form)
+ self.fanout_input = FanoutExchangeInput(app, "fanout")
self.add_child(self.fanout_input)
- self.xml_input = XMLExchangeInput(app, "xml", form)
+ self.xml_input = XMLExchangeInput(app, "xml")
self.add_child(self.xml_input)
- self.headers_input = HeadersExchangeInput(app, "headers", form)
+ self.headers_input = HeadersExchangeInput(app, "headers")
self.add_child(self.headers_input)
self.title = title
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -21,9 +21,8 @@
def __init__(self, app, name):
super(BrokerSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
- self.add_form_parameter(self.ids)
col = self.NameColumn(app, "name")
self.add_column(col)
@@ -32,13 +31,13 @@
col = self.GroupsColumn(app, "groups")
self.add_column(col)
- self.groups = self.BrokerSetGroupInput(app, "groups", self)
+ self.groups = self.BrokerSetGroupInput(app, "groups")
self.add_child(self.groups)
- self.__unregister = self.Unregister(app, "unregister", self)
+ self.__unregister = self.Unregister(app, "unregister")
self.add_child(self.__unregister)
- self.groupify = self.Groupify(app, "groupify", self)
+ self.groupify = self.Groupify(app, "groupify")
self.add_child(self.groupify)
def render_title(self, session, *args):
@@ -582,22 +581,18 @@
self.name_param = Parameter(app, "name_param");
self.add_parameter(self.name_param)
- self.add_form_parameter(self.name_param)
self.names = ListParameter(app, "name", self.name_param)
self.add_parameter(self.names)
- self.add_form_parameter(self.names)
self.name_errors = self.Errors(self, "name_errors")
self.add_attribute(self.name_errors)
self.addr_param = Parameter(app, "addr_param")
self.add_parameter(self.addr_param)
- self.add_form_parameter(self.addr_param)
self.addrs = ListParameter(app, "address", self.addr_param)
self.add_parameter(self.addrs)
- self.add_form_parameter(self.addrs)
self.addr_errors = self.Errors(self, "addr_errors")
self.add_attribute(self.addr_errors)
@@ -605,11 +600,9 @@
self.group_param = BrokerGroupParameter(app, "group_param")
self.group_param.default = None
self.add_parameter(self.group_param)
- self.add_form_parameter(self.group_param)
self.groups = ListParameter(app, "group", self.group_param)
self.add_parameter(self.groups)
- self.add_form_parameter(self.groups)
self.fields = IntegerParameter(app, "fields")
self.fields.default = 3
@@ -618,7 +611,7 @@
self.field_tmpl = Template(self, "field_html")
self.group_tmpl = Template(self, "group_html")
- self.more = self.MoreEntries(app, "more", self)
+ self.more = self.MoreEntries(app, "more")
self.add_child(self.more)
class Errors(Attribute):
@@ -772,11 +765,10 @@
def __init__(self, app, name):
super(BrokerEdit, self).__init__(app, name)
- self.broker_name = UniqueNameField(app, "name", self,
- BrokerRegistration)
+ self.broker_name = UniqueNameField(app, "name", BrokerRegistration)
self.add_field(self.broker_name)
- self.groups = BrokerGroupCheckboxField(app, "groups", self)
+ self.groups = BrokerGroupCheckboxField(app, "groups")
self.add_field(self.groups)
def init(self):
Modified: mgmt/trunk/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -103,7 +103,7 @@
def __init__(self, app, name):
super(BrokerClusterForm, self).__init__(app, name)
- self.cluster_name = StringInput(app, "name", self)
+ self.cluster_name = StringInput(app, "name")
self.add_child(self.cluster_name)
def process_cluster(self, session, cluster):
Modified: mgmt/trunk/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokergroup.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/brokergroup.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -41,13 +41,13 @@
return fmt_olink(branch, group, name=data["name"])
class BrokerGroupInputSet(CheckboxInputSet):
- def __init__(self, app, name, form):
- super(BrokerGroupInputSet, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(BrokerGroupInputSet, self).__init__(app, name, None)
- param = ListParameter(app, "param", BrokerGroupParameter(app,
"item"))
- self.add_parameter(param)
- self.set_parameter(param)
-
+ item = BrokerGroupParameter(app, "item")
+ self.param = ListParameter(app, "param", item)
+ self.add_parameter(self.param)
+
def do_get_items(self, session, *args):
return BrokerGroup.select()
@@ -62,13 +62,14 @@
return "checked=\"checked\""
class BrokerGroupCheckboxField(FormField):
- def __init__(self, app, name, form):
- super(BrokerGroupCheckboxField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(BrokerGroupCheckboxField, self).__init__(app, name)
- self.__inputs = BrokerGroupInputSet(app, "inputs", form)
- self.add_child(self.__inputs)
+ self.__groups = BrokerGroupInputSet(app, "inputs")
+ self.add_child(self.__groups)
- self.set_parameter(self.__inputs.get_parameter())
+ def get(self, session):
+ return self.__groups.get(session)
def render_title(self, session):
return "Broker Groups"
@@ -142,7 +143,7 @@
def __init__(self, app, name):
super(BrokerGroupForm, self).__init__(app, name)
- self.group_name = UniqueNameField(app, "name", self, BrokerGroup)
+ self.group_name = UniqueNameField(app, "name", BrokerGroup)
self.add_field(self.group_name)
def init(self):
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -18,7 +18,7 @@
self.ids = FilteredCheckboxIdColumn(app, "id", self,
callback=self.disable_closed)
self.add_column(self.ids)
- #self.ids = CheckboxIdColumn(app, "id", self)
+ #self.ids = CheckboxIdColumn(app, "id")
#self.add_column(self.ids)
col = self.AddressColumn(app, "addr")
@@ -40,7 +40,7 @@
#col = self.ToPeerColumn(app, "to_peer")
#self.add_column(col)
- self.__close = self.Close(app, "close", self)
+ self.__close = self.Close(app, "close")
self.add_child(self.__close)
def render_add_broker_link_url(self, session, vhost):
@@ -123,7 +123,7 @@
def __init__(self, app, name):
super(PeerRouteSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
#col = self.SourceColumn(app, "source")
@@ -145,7 +145,7 @@
col = self.ExcludesColumn(app, "excludes")
self.add_column(col)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
def get_args(self, session):
@@ -333,13 +333,12 @@
return "Messages Received, Routed, and Dropped"
class ExchangeRadioField(RadioField):
- def __init__(self, app, name, form):
- super(ExchangeRadioField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(ExchangeRadioField, self).__init__(app, name, None)
- self.exchange_param = Parameter(app, "exchange_param")
- self.exchange_param.default = ""
- self.add_parameter(self.exchange_param)
- form.add_form_parameter(self.exchange_param)
+ self.param = Parameter(app, "exchange_param")
+ self.param.default = ""
+ self.add_parameter(self.param)
self.exchange_tmpl = Template(self, "exchange_html")
@@ -348,19 +347,12 @@
self.phase = Parameter(app, "phase")
self.add_parameter(self.phase)
- form.add_form_parameter(self.phase)
- def get(self, session):
- return self.exchange_param.get(session)
-
- def set(self, session, value):
- self.exchange_param.set(session, value)
-
def render_title(self, session):
return "Choose an Exchange"
def render_exchange_name_path(self, session, exchange):
- return self.exchange_param.path
+ return self.param.path
def render_exchange_name(self, session, exchange):
return exchange.name or "Default"
@@ -372,7 +364,7 @@
return ".".join((self.path, str(exchange.id)))
def render_checked(self, session, exchange):
- return self.exchange_param.get(session) == str(exchange.id) and
"checked=\"checked\"" or ""
+ return self.param.get(session) == str(exchange.id) and
"checked=\"checked\"" or ""
def render_phase_path(self, session, *args):
return self.phase.path
@@ -388,7 +380,7 @@
not (self.state.is_active(session) and not is_active(exchange)):
if not exchange.name in ["qpid.management", ""]:
if not self.get(session):
- self.exchange_param.set(session, str(exchange.id))
+ self.exchange.set(session, str(exchange.id))
self.exchange_tmpl.render(writer, session, exchange)
return writer.to_string()
@@ -403,19 +395,19 @@
def __init__(self, app, name):
super(BridgeAdd, self).__init__(app, name)
- self.exchange = ExchangeRadioField(app, "exchange", self)
+ self.exchange = ExchangeRadioField(app, "exchange")
self.add_field(self.exchange)
- self.key = TextField(app, "key", self)
+ self.key = TextField(app, "key")
self.key.set_title("Routing Key")
self.add_field(self.key)
- self.tag = TextField(app, "tag", self)
+ self.tag = TextField(app, "tag")
self.tag.set_required(False)
self.tag.set_title("Tag")
self.add_field(self.tag)
- self.excludes = TextField(app, "excludes", self)
+ self.excludes = TextField(app, "excludes")
self.excludes.set_required(False)
self.excludes.set_title("Excludes")
self.add_field(self.excludes)
@@ -495,9 +487,8 @@
self.host = DictParameter(app, "host")
self.add_parameter(self.host)
- self.add_form_parameter(self.host)
- self.durable = SavedField(app, "saved", self)
+ self.durable = SavedField(app, "saved")
self.add_field(self.durable)
self.errors = self.Errors(self, "errors")
Modified: mgmt/trunk/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -104,7 +104,7 @@
def __init__(self, app, name):
super(BrokerProfileForm, self).__init__(app, name)
- self.profile_name = StringInput(app, "name", self)
+ self.profile_name = StringInput(app, "name")
self.add_child(self.profile_name)
def process_profile(self, session, profile):
Modified: mgmt/trunk/cumin/python/cumin/client.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/client.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -15,7 +15,7 @@
def __init__(self, app, name):
super(ConnectionSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
col = self.AddressColumn(app, "addr")
@@ -39,7 +39,7 @@
self.__phase = PhaseSwitch(app, "phase")
self.add_child(self.__phase)
- self.__close = self.Close(app, "close", self)
+ self.__close = self.Close(app, "close")
self.add_child(self.__close)
def get_args(self, session):
@@ -283,7 +283,7 @@
def __init__(self, app, name):
super(SessionSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
col = self.NameColumn(app, "name")
@@ -300,10 +300,10 @@
self.__phase = PhaseSwitch(app, "phase")
self.add_child(self.__phase)
- self.__detach = self.Detach(app, "detach", self)
+ self.__detach = self.Detach(app, "detach")
self.add_child(self.__detach)
- self.__close = self.Close(app, "close", self)
+ self.__close = self.Close(app, "close")
self.add_child(self.__close)
def get_args(self, session):
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -13,8 +13,8 @@
strings = StringCatalog(__file__)
class ExchangeInputSet(RadioInputSet):
- def __init__(self, app, name, form):
- super(ExchangeInputSet, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(ExchangeInputSet, self).__init__(app, name)
param = ExchangeParameter(app, "param")
self.add_parameter(param)
@@ -69,7 +69,7 @@
self.phase = PhaseSwitch(app, "phase")
self.add_child(self.phase)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
def get_args(self, session):
@@ -303,7 +303,7 @@
def __init__(self, app, name):
super(ExchangeBindingSet, self).__init__(app, name)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
self.set_default_column_name("q_id")
@@ -393,35 +393,30 @@
def __init__(self, app, name):
super(ExchangeForm, self).__init__(app, name)
- self.exchange_name = ExchangeNameField(app, "exchange_name", self)
+ self.exchange_name = ExchangeNameField(app, "exchange_name")
self.add_field(self.exchange_name)
self.type = Parameter(app, "type")
self.type.default = "direct"
self.add_parameter(self.type)
- self.direct = RadioInput(app, "direct", self)
- self.direct.set_parameter(self.type)
+ self.direct = RadioInput(app, "direct", self.type)
self.direct.set_value("direct")
self.add_child(self.direct)
- self.topic = RadioInput(app, "topic", self)
- self.topic.set_parameter(self.type)
+ self.topic = RadioInput(app, "topic", self.type)
self.topic.set_value("topic")
self.add_child(self.topic)
- self.fanout = RadioInput(app, "fanout", self)
- self.fanout.set_parameter(self.type)
+ self.fanout = RadioInput(app, "fanout", self.type)
self.fanout.set_value("fanout")
self.add_child(self.fanout)
- self.headers = RadioInput(app, "headers", self)
- self.headers.set_parameter(self.type)
+ self.headers = RadioInput(app, "headers", self.type)
self.headers.set_value("headers")
self.add_child(self.headers)
- self.xml = RadioInput(app, "xml", self)
- self.xml.set_parameter(self.type)
+ self.xml = RadioInput(app, "xml", self.type)
self.xml.set_value("xml")
self.add_child(self.xml)
@@ -549,4 +544,4 @@
def get_builtins(cls):
return ["", "amq.direct", "amq.topic",
"amq.match", "amq.fanout", "qpid.management"]
-
\ No newline at end of file
+
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -19,7 +19,7 @@
def __init__(self, app, name):
super(JobSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
col = self.GlobalJobIdColumn(app, "global_job_id")
@@ -184,13 +184,13 @@
self.set_default_column_name("global_job_id")
- self.__remove = JobRemoveButton(app, "remove", self)
+ self.__remove = JobRemoveButton(app, "remove")
self.add_child(self.__remove)
- self.__hold = JobHoldButton(app, "hold", self)
+ self.__hold = JobHoldButton(app, "hold")
self.add_child(self.__hold)
- self.__release = JobReleaseButton(app, "release", self)
+ self.__release = JobReleaseButton(app, "release")
self.add_child(self.__release)
def get_visible_columns(self, session):
@@ -416,13 +416,13 @@
self.set_default_column_name("global_job_id")
- self.__remove = JobRemoveButton(app, "remove", self)
+ self.__remove = JobRemoveButton(app, "remove")
self.add_child(self.__remove)
- self.__hold = JobHoldButton(app, "hold", self)
+ self.__hold = JobHoldButton(app, "hold")
self.add_child(self.__hold)
- self.__release = JobReleaseButton(app, "release", self)
+ self.__release = JobReleaseButton(app, "release")
self.add_child(self.__release)
def get_visible_columns(self, session):
@@ -680,7 +680,6 @@
# the parameter that will hold all the field values
self.ads = DictParameter(app, "params")
self.add_parameter(self.ads)
- self.add_form_parameter(self.ads)
self.item_renderer = EditablePropertyRenderer(self, "property_html")
@@ -760,7 +759,7 @@
self.first_last = self.FLSwitch(app, "first_last")
self.add_child(self.first_last)
- self.__fetch = self.FetchButton(app, "refresh", self)
+ self.__fetch = self.FetchButton(app, "refresh")
self.add_child(self.__fetch)
self.out_time = Attribute(app, "out_time")
@@ -771,15 +770,12 @@
self.out_file = Parameter(app, "out")
self.add_parameter(self.out_file)
- self.add_form_parameter(self.out_file)
self.err_file = Parameter(app, "err")
self.add_parameter(self.err_file)
- self.add_form_parameter(self.err_file)
self.user_file = Parameter(app, "user")
self.add_parameter(self.user_file)
- self.add_form_parameter(self.user_file)
def get_args(self, session):
return self.frame.get_args(session)
@@ -1003,7 +999,7 @@
def __init__(self, app, name):
super(JobGroupSet, self).__init__(app, name)
- self.ids = CheckboxStringIdColumn(app, "id", self)
+ self.ids = CheckboxStringIdColumn(app, "id")
self.add_column(self.ids)
col = self.GroupColumn(app, "job_group")
@@ -1081,13 +1077,13 @@
def __init__(self, app, name):
super(JobGroupTab, self).__init__(app, name)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
- self.__hold = self.Hold(app, "hold", self)
+ self.__hold = self.Hold(app, "hold")
self.add_child(self.__hold)
- self.__release = self.Release(app, "release", self)
+ self.__release = self.Release(app, "release")
self.add_child(self.__release)
self.set_default_column_name("job_group")
@@ -1137,7 +1133,6 @@
self.reason = Parameter(app, "reason")
self.add_parameter(self.reason)
- self.add_form_parameter(self.reason)
self.error = Attribute(app, "error")
self.add_attribute(self.error)
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -149,7 +149,6 @@
self.max = Parameter(app, "max")
self.add_parameter(self.max)
- self.add_form_parameter(self.max)
self.error = self.Errors(self, "error")
self.add_attribute(self.error)
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -24,7 +24,7 @@
def __init__(self, app, name):
super(QueueSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
col = self.NameColumn(app, "name")
@@ -58,10 +58,10 @@
self.phase = PhaseSwitch(app, "phase")
self.add_child(self.phase)
- self.__purge = self.Purge(app, "purge", self)
+ self.__purge = self.Purge(app, "purge")
self.add_child(self.__purge)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
def render_add_queue_url(self, session, vhost):
@@ -284,7 +284,7 @@
def __init__(self, app, name):
super(QueueBindingSet, self).__init__(app, name)
- self.__remove = self.Remove(app, "remove", self)
+ self.__remove = self.Remove(app, "remove")
self.add_child(self.__remove)
self.set_default_column_name("e_id")
@@ -325,19 +325,19 @@
def __init__(self, app, name):
super(QueueForm, self).__init__(app, name)
- self.namef = NameField(app, "name", self)
+ self.namef = NameField(app, "name")
self.add_field(self.namef)
- self.durable = DurabilityField(app, "durable", self)
+ self.durable = DurabilityField(app, "durable")
self.add_field(self.durable)
- #self.exclusive = ExclusivityField(app, "exclusive", self)
+ #self.exclusive = ExclusivityField(app, "exclusive")
#self.add_field(self.exclusive)
- self.autodelete = AutoDeleteField(app, "autodelete", self)
+ self.autodelete = AutoDeleteField(app, "autodelete")
self.add_field(self.autodelete)
- self.bindings = ExchangeKeysField(app, "bindings", self)
+ self.bindings = ExchangeKeysField(app, "bindings")
self.add_field(self.bindings)
def validate(self, session, queue_name):
@@ -403,7 +403,7 @@
def __init__(self, app, name):
super(QueuePurge, self).__init__(app, name)
- self.purge_request = MultiplicityField(app, "purge_request", self)
+ self.purge_request = MultiplicityField(app, "purge_request")
self.add_field(self.purge_request)
def get_args(self, session):
@@ -478,8 +478,8 @@
return "Remove Queue '%s'" % Queue.get(id).name
class BindSummaryPropertiesField(FormField):
- def __init__(self, app, name, form):
- super(BindSummaryPropertiesField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(BindSummaryPropertiesField, self).__init__(app, name)
self.sum_props = self.SummaryProperties(app, "properties")
self.add_child(self.sum_props)
@@ -508,10 +508,10 @@
def __init__(self, app, name):
super(QueueBindingAdd, self).__init__(app, name)
- self.props = BindSummaryPropertiesField(app, "props", self)
+ self.props = BindSummaryPropertiesField(app, "props")
self.add_field(self.props)
- self.bindings = ExchangeKeysField(app, "bindings", self,
title="Bind to Exchange:")
+ self.bindings = ExchangeKeysField(app, "bindings", title="Bind to
Exchange:")
self.add_field(self.bindings)
self.errors = self.Errors(self, "errors")
Modified: mgmt/trunk/cumin/python/cumin/realm.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/realm.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/realm.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -20,8 +20,8 @@
return realm.name
class RealmInputSet(CheckboxInputSet):
- def __init__(self, app, name, form):
- super(RealmInputSet, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(RealmInputSet, self).__init__(app, name)
param = ListParameter(app, "param", RealmParameter(app,
"item"))
self.add_parameter(param)
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -13,9 +13,8 @@
def __init__(self, app, name):
super(SystemSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
- self.add_form_parameter(self.ids)
col = self.NameColumn(app, "name")
self.add_column(col)
Modified: mgmt/trunk/cumin/python/cumin/user.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/user.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/user.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -66,15 +66,15 @@
self.__login_invalid = Attribute(app, "login_invalid")
self.add_attribute(self.__login_invalid)
- self.__name = self.Name(app, "name", self)
+ self.__name = self.Name(app, "name")
self.add_field(self.__name)
- self.__name.get_input().set_size(20)
+ self.__name.input.set_size(20)
- self.__password = self.Password(app, "password", self)
+ self.__password = self.Password(app, "password")
self.add_field(self.__password)
- self.__password.get_input().set_size(20)
+ self.__password.input.set_size(20)
- self.__submit = self.Submit(app, "submit", self)
+ self.__submit = self.Submit(app, "submit")
self.add_child(self.__submit)
def do_process(self, session):
@@ -128,17 +128,17 @@
self.__errors = self.Errors(app, "errors")
self.add_attribute(self.__errors)
- self.__current = self.Current(app, "current", self)
+ self.__current = self.Current(app, "current")
self.add_field(self.__current)
- self.__current.get_input().set_size(20)
+ self.__current.input.size = 20
- self.__new0 = self.New0(app, "new0", self)
+ self.__new0 = self.New0(app, "new0")
self.add_field(self.__new0)
- self.__new0.get_input().set_size(20)
+ self.__new0.input.size = 20
- self.__new1 = self.New1(app, "new1", self)
+ self.__new1 = self.New1(app, "new1")
self.add_field(self.__new1)
- self.__new1.get_input().set_size(20)
+ self.__new1.input.size = 20
def process_cancel(self, session):
branch = session.branch()
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -147,23 +147,23 @@
self.frame.show_remove(branch)
return branch.marshal()
-class FormHelp(FormInput):
- def __init__(self, app, name, form):
- super(FormHelp, self).__init__(app, name, form)
+class FormHelp(Widget):
+ def __init__(self, app, name):
+ super(FormHelp, self).__init__(app, name)
class CuminForm(Form):
def __init__(self, app, name):
super(CuminForm, self).__init__(app, name)
- self.__cancel = self.Cancel(app, "cancel", self)
+ self.__cancel = self.Cancel(app, "cancel")
self.__cancel.set_tab_index(201)
self.add_child(self.__cancel)
- self.__submit = self.Submit(app, "submit", self)
+ self.__submit = self.Submit(app, "submit")
self.__submit.set_tab_index(200)
self.add_child(self.__submit)
- self.__help = self.Help(app, "help", self)
+ self.__help = self.Help(app, "help")
self.add_child(self.__help)
def submit(self, session):
@@ -663,11 +663,11 @@
return self.paginator.get_bounds(session)
class BrokerGroupInput(OptionInputSet):
- def __init__(self, app, name, form):
- super(BrokerGroupInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(BrokerGroupInput, self).__init__(app, name, None)
- self.set_parameter(BrokerGroupParameter(app, "param"))
- self.add_parameter(self.get_parameter())
+ self.param = BrokerGroupParameter(app, "param")
+ self.add_parameter(self.param)
def do_get_items(self, session):
return list(BrokerGroup.select()) #XXX avoid list()ing this?
@@ -682,7 +682,7 @@
def __init__(self, app, name):
super(BindingSet, self).__init__(app, name)
- self.ids = CheckboxIdColumn(app, "id", self)
+ self.ids = CheckboxIdColumn(app, "id")
self.add_column(self.ids)
col = self.QNameColumn(app, "q_id")
@@ -755,29 +755,25 @@
binding = Binding.get(data["id"])
return self.app.model.binding.msgMatched.value(binding)
-class CheckboxIdColumn(SqlTableColumn):
- def __init__(self, app, name, form):
- super(CheckboxIdColumn, self).__init__(app, name)
+class CheckboxIdColumn(FormInput, SqlTableColumn):
+ def __init__(self, app, name):
+ super(CheckboxIdColumn, self).__init__(app, name, None)
- self.form = form
self.header_class = CheckboxIdColumnHeader
- param = IntegerParameter(app, "param")
- self.add_parameter(param)
+ item = IntegerParameter(app, "param")
+ self.add_parameter(item) # XXX lose this?
- self.ids = ListParameter(app, "id", param)
- self.add_parameter(self.ids)
+ self.param = ListParameter(app, "id", item)
+ self.add_parameter(self.param)
- def get(self, session):
- return self.ids.get(session)
-
def clear(self, session):
- self.ids.set(session, list())
+ self.param.set(session, list())
def do_render(self, session, data, disabled=False):
- name = self.ids.path
+ name = self.param.path
id = data[self.name]
- attr = id in self.ids.get(session) and "checked=\"checked\""
or ""
+ attr = id in self.param.get(session) and
"checked=\"checked\"" or ""
disa = disabled and "disabled=\"disabled\"" or ""
t = "<td><input type=\"checkbox\" name=\"%s\"
value=\"%i\" %s %s/></td>"
@@ -788,11 +784,11 @@
return self.column.form.path
def render_elem_name(self, session, *args):
- return self.column.ids.path
+ return self.column.param.path
class FilteredCheckboxIdColumn(CheckboxIdColumn):
def __init__(self, app, name, form, callback=None):
- super(FilteredCheckboxIdColumn, self).__init__(app, name, form)
+ super(FilteredCheckboxIdColumn, self).__init__(app, name)
# call back that returns True if the checkbox is to be disabled
self.__callback = callback
@@ -803,10 +799,9 @@
disabled=disabled)
class CheckboxStringIdColumn(SqlTableColumn):
- def __init__(self, app, name, form):
+ def __init__(self, app, name):
super(CheckboxStringIdColumn, self).__init__(app, name)
- self.form = form
self.header_class = CheckboxIdColumnHeader
param = Parameter(app, "param")
@@ -832,8 +827,8 @@
class NameField(StringField):
- def __init__(self, app, name, form):
- super(NameField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(NameField, self).__init__(app, name)
self.required = True
self.illegal_chars = ""
@@ -862,8 +857,8 @@
break
class TextField(NameField):
- def __init__(self, app, name, form):
- super(TextField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(TextField, self).__init__(app, name)
self.__title = "Title"
@@ -874,8 +869,8 @@
return self.__title
class ExchangeNameField(NameField):
- def __init__(self, app, name, form):
- super(ExchangeNameField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(ExchangeNameField, self).__init__(app, name)
self.illegal_chars = " (){}[]-<>&%"
self.legal_chars_desc = """
@@ -884,8 +879,8 @@
"""
class UniqueNameField(NameField):
- def __init__(self, app, name, form, cls, fld="name"):
- super(UniqueNameField, self).__init__(app, name, form)
+ def __init__(self, app, name, cls, fld="name"):
+ super(UniqueNameField, self).__init__(app, name)
self.__class = cls
self.__field = fld
@@ -921,19 +916,18 @@
return "An item with this %s already exists" % self.__field
class DurabilityField(RadioField):
- def __init__(self, app, name, form):
- super(DurabilityField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(DurabilityField, self).__init__(app, name, None)
- param = Parameter(app, "param")
- param.default = "durable"
- self.add_parameter(param)
- self.set_parameter(param)
+ self.param = Parameter(app, "param")
+ self.param.default = "durable"
+ self.add_parameter(self.param)
- option = self.Durable(app, "durable", form)
- option.set_value(param.default)
+ option = self.Durable(app, "durable", self.param)
+ option.set_value(self.param.default)
self.add_option(option)
- option = self.Transient(app, "transient", form)
+ option = self.Transient(app, "transient", self.param)
option.set_value("transient")
self.add_option(option)
@@ -955,19 +949,18 @@
return "Transient"
class SavedField(RadioField):
- def __init__(self, app, name, form):
- super(SavedField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(SavedField, self).__init__(app, name, None)
- param = Parameter(app, "param")
- param.default = "notsaved"
- self.add_parameter(param)
- self.set_parameter(param)
+ self.param = Parameter(app, "param")
+ self.param.default = "notsaved"
+ self.add_parameter(self.param)
- option = self.Saved(app, "saved", form)
+ option = self.Saved(app, "saved", self.param)
option.set_value("saved")
self.add_option(option)
- option = self.NotSaved(app, "notsaved", form)
+ option = self.NotSaved(app, "notsaved", self.param)
option.set_value("notsaved")
self.add_option(option)
@@ -989,19 +982,18 @@
return "No, do not restore if broker restarts"
class ExclusivityField(RadioField):
- def __init__(self, app, name, form):
- super(ExclusivityField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(ExclusivityField, self).__init__(app, name)
- param = Parameter(app, "param")
- param.default = "exclusive"
- self.add_parameter(param)
- self.set_parameter(param)
+ self.param = Parameter(app, "param")
+ self.param.default = "exclusive"
+ self.add_parameter(self.param)
- option = self.Exclusive(app, "exclusive", form)
- option.set_value(param.default)
+ option = self.Exclusive(app, "exclusive")
+ option.set_value(self.param.default)
self.add_option(option)
- option = self.NonExclusive(app, "non-exclusive", form)
+ option = self.NonExclusive(app, "non-exclusive")
option.set_value("non-exclusive")
self.add_option(option)
@@ -1023,17 +1015,16 @@
return "Non-exclusive"
class MultiplicityField(RadioField):
- def __init__(self, app, name, form):
- super(MultiplicityField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(MultiplicityField, self).__init__(app, name, None)
- param = Parameter(app, "param")
- param.default = "all"
- self.add_parameter(param)
- self.set_parameter(param)
+ self.param = Parameter(app, "param")
+ self.param.default = "all"
+ self.add_parameter(self.param)
- self.add_option(self.All(app, "all", form))
- self.add_option(self.Top(app, "top", form))
- self.top_n = self.TopN(app, "topn", form)
+ self.add_option(self.All(app, "all", self.param))
+ self.add_option(self.Top(app, "top", self.param))
+ self.top_n = self.TopN(app, "topn", self.param)
self.add_option(self.top_n)
def render_title(self, session):
@@ -1054,11 +1045,10 @@
return "Top message"
class TopN(RadioFieldOption):
- def __init__(self, app, name, form):
- super(MultiplicityField.TopN, self).__init__(app, name, form)
+ def __init__(self, app, name, param):
+ super(MultiplicityField.TopN, self).__init__(app, name, param)
self.__n_value = IntegerParameter(app, "arg")
- form.add_form_parameter(self.__n_value)
self.add_parameter(self.__n_value)
def render_value(self, session):
@@ -1077,19 +1067,18 @@
return
class AutoDeleteField(RadioField):
- def __init__(self, app, name, form):
- super(AutoDeleteField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(AutoDeleteField, self).__init__(app, name, None)
- param = Parameter(app, "param")
- param.default = "autodel"
- self.add_parameter(param)
- self.set_parameter(param)
+ self.param = Parameter(app, "param")
+ self.param.default = "autodel"
+ self.add_parameter(self.param)
- option = self.AutoDel(app, "autodel", form)
- option.set_value(param.default)
+ option = self.AutoDel(app, "autodel", self.param)
+ option.set_value(self.param.default)
self.add_option(option)
- option = self.Preserve(app, "preserve", form)
+ option = self.Preserve(app, "preserve", self.param)
option.set_value("preserve")
self.add_option(option)
Modified: mgmt/trunk/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/__init__.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/wooly/__init__.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -1,4 +1,4 @@
-import sys, os
+import sys, os, logging
from cStringIO import StringIO
from urllib import quote, unquote_plus, unquote
from copy import copy
@@ -111,6 +111,8 @@
self.sealed = False
def init(self):
+ #print "Initializing %s" % str(self)
+
assert not self.sealed
ancestors = list()
@@ -150,7 +152,9 @@
def add_child(self, child):
assert not self.sealed
+ assert child is not None
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-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -30,9 +30,6 @@
return origin
- def add_form_parameter(self, param):
- self.form_params.add(param)
-
def render_hidden_inputs(self, session, *args):
writer = Writer()
# remember our roots
@@ -103,25 +100,30 @@
return list()
class FormInput(Widget):
- def __init__(self, app, name, form):
+ def __init__(self, app, name, param):
super(FormInput, self).__init__(app, name)
- self.form = form
- self.param = None
-
+ self.param = param
self.tab_index = 100
self.disabled = False
- def set_parameter(self, param):
- if self.param:
- raise Exception("Parameter already set")
+ self.form = None
- self.param = param;
- self.form.add_form_parameter(self.param)
+ def init(self):
+ super(FormInput, self).init()
- def get_parameter(self):
- return self.param
+ assert self.param is not None
+ assert isinstance(self.param, Parameter)
+ for anc in reversed(self.ancestors):
+ if isinstance(anc, Form):
+ self.form = anc
+
+ if self.form:
+ self.form.form_params.add(self.param)
+ else:
+ print "Warning: FormInput '%s' not inside a form" % self
+
def get(self, session):
return self.param.get(session)
@@ -158,11 +160,12 @@
super(EmptyInputError, self).__init__("This value is required")
class ScalarInput(FormInput):
- def __init__(self, app, name, form):
- super(ScalarInput, self).__init__(app, name, form)
+ def __init__(self, app, name, param):
+ super(ScalarInput, self).__init__(app, name, param)
self.size = 32
+ # XXX lose this
def set_size(self, size):
self.size = size
@@ -170,43 +173,44 @@
return self.size
class StringInput(ScalarInput):
- def __init__(self, app, name, form):
- super(StringInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(StringInput, self).__init__(app, name, None)
- self.set_parameter(Parameter(app, "param"))
- self.add_parameter(self.get_parameter())
+ self.param = Parameter(app, "param")
+ self.add_parameter(self.param)
- self.set_size(30)
+ self.size = 30
class PasswordInput(StringInput):
pass
class IntegerInput(ScalarInput):
- def __init__(self, app, name, form):
- super(IntegerInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(IntegerInput, self).__init__(app, name, None)
- self.set_parameter(IntegerParameter(app, "param"))
- self.add_parameter(self.get_parameter())
+ self.param = IntegerParameter(app, "param")
+ self.add_parameter(self.param)
- self.set_size(15)
+ self.size = 15
class CheckboxInput(FormInput):
- def __init__(self, app, name, form):
- super(CheckboxInput, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(CheckboxInput, self).__init__(app, name, None)
- self.set_parameter(VoidBooleanParameter(app, "param"))
- self.add_parameter(self.get_parameter())
+ self.param = VoidBooleanParameter(app, "param")
+ self.add_parameter(self.param)
def render_checked_attr(self, session, *args):
if self.get(session):
return "checked=\"checked\""
class RadioInput(FormInput):
- def __init__(self, app, name, form):
- super(RadioInput, self).__init__(app, name, form)
+ def __init__(self, app, name, param):
+ super(RadioInput, self).__init__(app, name, param)
self.value = None
-
+
+ # XXX lose this
def set_value(self, value):
self.value = value
@@ -220,11 +224,11 @@
return "checked=\"checked\""
class FormButton(FormInput):
- def __init__(self, app, name, form):
- super(FormButton, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(FormButton, self).__init__(app, name, None)
- self.set_parameter(BooleanParameter(app, "param"))
- self.add_parameter(self.get_parameter())
+ self.param = BooleanParameter(app, "param")
+ self.add_parameter(self.param)
def do_process(self, session, *args):
if self.get(session):
@@ -284,33 +288,12 @@
return writer.to_string()
class FormField(Widget):
- def __init__(self, app, name, form):
+ def __init__(self, app, name):
super(FormField, self).__init__(app, name)
- self.__form = form
- self.__param = None
-
self.__errors = FormErrorSet(app, "errors")
self.add_child(self.__errors)
- def get_parameter(self):
- return self.__param
-
- def set_parameter(self, param):
- assert isinstance(param, Parameter)
-
- self.__param = param
- return param
-
- def get_form(self):
- return self.__form
-
- def get(self, session):
- return self.__param.get(session)
-
- def set(self, session, value):
- return self.__param.set(session, value)
-
def validate(self, session):
errors = self.__errors.get(session)
@@ -322,62 +305,69 @@
pass
class ScalarField(FormField):
- def __init__(self, app, name, form):
- super(ScalarField, self).__init__(app, name, form)
+ def __init__(self, app, name, input):
+ super(ScalarField, self).__init__(app, name)
- self.__input = None
+ self.input = input
- def get_input(self):
- return self.__input
+ def init(self):
+ super(ScalarField, self).init()
- def set_input(self, input):
- assert isinstance(input, FormInput)
+ assert self.input is not None
+ assert isinstance(self.input, ScalarInput)
- self.set_parameter(input.get_parameter())
- self.__input = input
+ def get(self, session):
+ return self.input.get(session)
- return input
+ def set(self, session, value):
+ return self.input.set(session, value)
def render_inputs(self, session, *args):
- return self.__input.render(session)
+ return self.input.render(session)
class StringField(ScalarField):
- def __init__(self, app, name, form):
- super(StringField, self).__init__(app, name, form)
-
- input = StringInput(app, "input", form)
- self.add_child(input)
- self.set_input(input)
+ def __init__(self, app, name):
+ super(StringField, self).__init__(app, name, None)
+ self.input = StringInput(app, "input")
+ self.add_child(self.input)
+
class PasswordField(ScalarField):
- def __init__(self, app, name, form):
- super(PasswordField, self).__init__(app, name, form)
-
- input = PasswordInput(app, "input", form)
- self.add_child(input)
- self.set_input(input)
+ def __init__(self, app, name):
+ super(PasswordField, self).__init__(app, name, None)
+ self.input = PasswordInput(app, "input")
+ self.add_child(self.input)
+
class IntegerField(ScalarField):
- def __init__(self, app, name, form):
- super(IntegerInputField, self).__init__(app, name, form)
+ def __init__(self, app, name):
+ super(IntegerInputField, self).__init__(app, name, None)
- input = IntegerInput(app, "input", form)
- self.add_child(input)
- self.set_input(input)
+ self.input = PasswordInput(app, "input")
+ self.add_child(self.input)
+# XXX make this use a RadioInputSet instead?
class RadioField(FormField):
- def __init__(self, app, name, form):
- super(RadioField, self).__init__(app, name, form)
+ def __init__(self, app, name, param):
+ super(RadioField, self).__init__(app, name)
+ self.param = param
self.options = list()
+ def init(self):
+ super(RadioField, self).init()
+
+ assert self.param is not None
+ assert isinstance(self.param, Parameter)
+
def add_option(self, option):
assert isinstance(option, RadioFieldOption)
- option.set_parameter(self.get_parameter())
self.options.append(option)
self.add_child(option)
+ option.param = self.param
+
def render_inputs(self, session, *args):
writer = Writer()
Modified: mgmt/trunk/misc/boneyard.py
===================================================================
--- mgmt/trunk/misc/boneyard.py 2008-10-03 11:09:19 UTC (rev 2584)
+++ mgmt/trunk/misc/boneyard.py 2008-10-03 13:27:39 UTC (rev 2585)
@@ -153,30 +153,27 @@
self.source.default = "local"
self.add_parameter(self.source)
- self.profile = RadioInput(app, "profile", self)
- self.profile.set_parameter(self.source)
+ self.profile = RadioInput(app, "profile", self.source)
self.profile.set_value("profile")
self.add_child(self.profile)
- self.pvalue = StringInput(app, "profile_value", self)
+ self.pvalue = StringInput(app, "profile_value")
self.pvalue.set_disabled(True)
self.add_child(self.pvalue)
- self.broker = RadioInput(app, "broker", self)
- self.broker.set_parameter(self.source)
+ self.broker = RadioInput(app, "broker", self.source)
self.broker.set_value("broker")
self.add_child(self.broker)
- self.svalue = StringInput(app, "broker_value", self)
+ self.svalue = StringInput(app, "broker_value")
self.svalue.set_disabled(True)
self.add_child(self.svalue)
- self.local = RadioInput(app, "local", self)
- self.local.set_parameter(self.source)
+ self.local = RadioInput(app, "local", self.source)
self.local.set_value("local")
self.add_child(self.local)
- self.lvalue = StringInput(app, "local_value", self)
+ self.lvalue = StringInput(app, "local_value")
self.add_child(self.lvalue)
def render_title(self, session, prop):