durusmail: quixote-users: form2 Form.has_key
form2 Form.has_key
form2 Form.has_key
Christoph Devenoges
2004-01-04
hi,

is there any reason why the form2 Form (0.7a3) class doesnt implement the
has_key method? There is after all a __getitem__?


this allows stuff like:
bookings = form.has_key('apartment') and form['apartment'].bookings \
           or \
           form.has_key('customer') and form['customer'].bookings or []

instead of:


in this case either widget may be present and contains a list of
objects that are treated identically by the rest of the form.

seems tidier then using the _names attribute of Form and it must be
called "_"names for some reason.

or did i miss something obvious?

kind regards,
chris


--
"it only takes 20 years for a liberal to become a conservative without
changing a single idea."  -- Robert Anton Wilson

http://devenoges.com/plog/    photographic weblog, (made with quixote)


reply