I'm trying to pass a dictionary from a form to a script. The following are snips from the Page Template that contains the form. ----------------------------------- . . . <input type="radio" name="feed.calc_method:records" value ="ration_cost" checked> . . . <input type="hidden" name="feed.feed_cost_ton:float:records:default" value="0"> <input type="text" name ="feed.feed_cost_ton:float:records:ignore_empty"> . . . <input type="hidden" name="feed.fed_per_day:float:records:default" value="0"> <input type="text" name ="feed.fed_per_day:float:records:ignore_empty"> . . . ----------------------- What shows up in the REQUEST object is this: feed = [calc_method: 'ration_cost', fed_per_day: 6.0, feed_cost_ton: 66.0] This is not a dictionary (len(feed)=1) it looks like a one element list (that looks like it was or is trying to be a dictionary). Using Zope 2.5.0. What am I doing wrong? -------------------------------------------------------------------- Ronald L. Roeber CIT-IANR University of Nebraska Lincoln, NE 68583 Phone: (402) 472-5630 email: rroeber1@unl.edu
Ronald L Roeber writes:
... <input name="feed.calc_method:records" ...> .... What shows up in the REQUEST object is this:
feed = [calc_method: 'ration_cost', fed_per_day: 6.0, feed_cost_ton: 66.0]
This is not a dictionary (len(feed)=1) it looks like a one element list (that looks like it was or is trying to be a dictionary). Using Zope 2.5.0. It's a "ZPublisher.HTTPRequest.record" instance, not a dictionay.
Such record instances behave like mappings (have "get", "keys", "items", "values", "copy" and "has_key" methods) and support both subscription and attribute access. You can get a standard dictionary from a record instance "r" by "r.copy()". Dieter
participants (2)
-
Dieter Maurer -
Ronald L Roeber