Hi Annet -
Try something like this:
On Mon, Apr 20, 2009 at 1:37 AM, annet <[email protected]> wrote:
>
> In the following function, the idea is to select a club's data based
> on the id in request.args. Then if the club's status is 0 (the field
> is of type string) the function should redirect to an other
> application, else the address and nfa data should be selected from the
> database and returned to the details view.
>
>
> def details():
> id=request.args[0]
> club=db(db.bedrijf.id==id).select(db.bedrijf.ALL)
> if club[0].bedrijf.status=='0':
This looks wrong; since club[0] is a row from db.bedrijf, it should read
like this:
if club[0].status == '0':
>
> redirect(URL(a='site',c='default',f='index',args=id))
> else:
> address=db((db.adres.bedrijf==id)&
> (db.adres.adressoort=='Vestigingsadres')).select()
> nfas=db((db.bedrijfnfa.bedrijf==id)&
> (db.bedrijfnfa.nfatype==db.nfatype.id))\
> .select
>
> (db.bedrijfnfa.nfatype,db.bedrijfnfa.adres,db.nfatype.nfatype,orderby=db.bedrijfnfa.nfatype)
> if not club and address and nfas: redirect(URL
> (r=request,f='byplace'))
> return dict(club=club[0],address=address[0],nfas=nfas)
>
>
> This function is not working, the error references the if statement, I
> have been tinkering with it, but then, even though the status of a
> club is not 0 the function redirects.
>
> What am I doing wrong?
>
>
> Best regards,
>
> Annet.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---