[Twisted-web] Re: Passing context through/around/across webform
mesozoic at polynode.com
Tue Oct 19 11:27:10 MDT 2004
On Tue, Oct 19, 2004 at 07:27:57PM +0300, Tommi Virtanen wrote:
> James Y Knight wrote:
> >Here's my horribly hacked up copy of Choice that works for what I need.
> >The changes from the normal Choice are that choicesAttribute is really
> >choicesMethod, and that it's supposed to return a list of (id, text),
> Sounds like you should use dict instead of a list. Otherwise there could
> be duplicate ids.
This is true, except that you will sometimes need a way to specify what
order the items appear in -- which might mean a (dict, list) tuple, or
something of the sort.
I'm having some initial success with this approach in Payago, and if I come
up with something generic enough to be useful to others, I'll post it back
The real problem is getting the context object passed down to the
Typed.coerce call, so that you don't have to implement code to "retrieve my
(dict, list) and check for the key" in a million different places.
"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_
More information about the Twisted-web