Author: justi9
Date: 2007-10-27 10:02:31 -0400 (Sat, 27 Oct 2007)
New Revision: 1172
Modified:
mgmt/cumin/python/wooly/forms.py
Log:
Fixes form marshaling of collection parameters such as ListParameter.
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2007-10-27 02:04:05 UTC (rev 1171)
+++ mgmt/cumin/python/wooly/forms.py 2007-10-27 14:02:31 UTC (rev 1172)
@@ -22,15 +22,29 @@
for param in params:
key = param.path()
- value = session.get(key)
- default = param.get_default(session)
+
+ if param.is_collection:
+ collection = session.get(key)
- if value not in (default, None):
- writer.write("<input type='hidden' name='%s'
value='%s'/>" \
- % (key, param.marshal(value)))
+ if collection:
+ for value in collection:
+ svalue = param.marshal(value)
+ self.write_hidden_input(key, svalue, writer)
+ else:
+ value = session.get(key)
+ default = param.get_default(session)
+ if value not in (default, None):
+ svalue = param.marshal(value)
+ self.write_hidden_input(key, svalue, writer)
+
return writer.to_string()
+ def write_hidden_input(self, name, value, writer):
+ writer.write("<input type='hidden' name='%s'
value='%s'/>" \
+ % (name, value))
+
+
class FormInput(Widget):
def __init__(self, app, name, form):
super(FormInput, self).__init__(app, name)
Show replies by date