You have to set clubs because you use it in other place. Probably you
you clubs in a view and it have to be defined (even with a blank list)
- if you don't define, Python will raise an exception. You can define
clubs = [] before if and not in elif and else.

On 4/11/09, jmverm...@xs4all.nl <jmverm...@xs4all.nl> wrote:
>
> Denes and Alvaro,
>
> Thanks for your replies.
>
> The by place function now reads like:
>
> def byplace():
>     response.functionname=T('Club locator op plaats')
>     response.image=URL(r=request,c='static',f='media/core/banner.png')
>     form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
>     widget=lambda self, value:INPUT
> (_id='byplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)))
>     if form.accepts(request.vars,session):
>         clubs=db((db.bedrijf.id==db.adres.bedrijf)&
> (db.bedrijf.id==db.bedrijfinschrijving.bedrijf)&\
>         (db.adres.plaats==request.vars.plaats)&
> (db.adres.adressoort=='vestigingsadres')&
>         (db.bedrijfinschrijving.inschrijving=='fitnessclub'))\
>         .select
> (db.bedrijf.id,db.bedrijf.bedrijfsnaam,db.bedrijf.status,\
>         db.adres.straat,orderby=db.bedrijf.status|
> db.bedrijf.bedrijfsnaam)
>     elif form.errors:
>         response.flash='form has errors'
>         clubs=[]
>     else:
>         response.flash='please fill the form'
>         clubs=[]
>     return dict(form=form,clubs=clubs)
>
>
> And does exactly what I want it to do under all circumstances. Two
> more questions though:
>
> When I remove clubs=[] an error ticket is issued telling me that clubs
> is being used before being assigned a value. I haven't seen this:
>
> elif form.errors:
>         response.flash='form has errors'
>         clubs=[]
>
> in the web2py manual.
>
>
> Furthermore, when I remove requires=IS_NOT_EMPTY() the functionality
> breaks, so I need both IS_NOT_EMPTY and requires.self.requires, why?
>
>
> Annet.
> >
>


-- 
 Álvaro Justen
 Peta5 - Telecomunicações e Software Livre
 21 3021-6001 / 9898-0141
 http://www.peta5.com.br/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to