On Sun, 2011-06-26 at 13:04 +0200, Vlad K. wrote:
> Thanks for your reply, but the problem is there is no 
> request.POST("var"), there is request.POST("var[foo]") and at that point 
> I don't know all the possible values of "foo". I solved with with a 
> custom extraction function.
> 
> 
> While I'm at it, though, I wonder how others are solving the same 
> problem. In PHP there are no sequences and dicts, just one associative 
> array entity, so things like:
> 
> var['a']['b'] = c
> 
> are perfectly valid ad hoc, even if var was never used before, while 
> Python would complain about missing key 'a' in dict var.
> 
> So the actual problem is this. I have a form with a table. Columns are 
> entity fields, rows are individual entities, just like in a database. 
> For a PHP backend the form would be constructed as:
> 
> <input type="text" name="foo[1]" value="123" />
> <input type="text" name="bar[1]" value="123" />
> <input type="text" name="baz[1]" value="123" />
> <input type="text" name="gah[1]" value="123" />
> 
> with that being single row, entities having columns foo, bar, baz and 
> gah, and the value in brackets is the row ID. One solution would be:
> 
> <input type="text" name="foo" value="123" />
> <input type="text" name="bar" value="123" />
> <input type="text" name="baz" value="123" />
> <input type="text" name="gah" value="123" />
> <input type="hidden" name="id" value="1" />
> 
> But I can't trust that the order given in the form is the same given 
> through POST and especially the same reconstructed via WebOb's multidict 
> entities (since Python's dicts are not ordered).

This is actually not quite true.  See http://plope.com/peppercorn (which
might be something you'd want to use).

- C




-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to