++ Roger E. Masse wrote on Sun, Jan 04, 2004 at 01:08:52PM -0500 :
> Christoph Devenoges writes:
>
> > 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 []
>
> Another alternative is to use get:
>
> bookings = form.get('apartment') or []
which gives:
AttributeError: Form instance has no attribute 'get'
i have subclassed form for my site and added get, has_key and has_value
methods... these are all one-liners so i wont bother sending a patch.
thanks for your response and for making a framework that makes
web development almost fun again.
chris