[web2py] request.args returns each arg as string

2012-02-13 Thread Annet
I posted a question asking why this doesn't work:

if request.args(0)==1

the answer: request.args returns each arg as string

However, in my application I use this multiple times:

rows=db(db.node.id==request.args(0)).select(db.node.ALL)

where id is of type integer and not string. What is the difference
between the first use request.args(0) and the second use?


Kind regards,

Annet.


[web2py] request.args returns each arg as string

2012-02-13 Thread Annet
I posted a question asking why this doesn't work:

if request.args(0)==1

the answer: request.args returns each arg as string

However, in my application I use this multiple times:

rows=db(db.node.id==request.args(0)).select(db.node.ALL)

where id is of type integer and not string. What is the difference
between the first use request.args(0) and the second use?


Kind regards,

Annet.


Re: [web2py] request.args returns each arg as string

2012-02-13 Thread Bruno Rocha
in the second example the DAL query operator == is taking care of trying to
convert your data to the right type.

http://zerp.ly/rochacbruno
Em 14/02/2012 05:14, Annet anneve...@googlemail.com escreveu:

 I posted a question asking why this doesn't work:

 if request.args(0)==1

 the answer: request.args returns each arg as string

 However, in my application I use this multiple times:

 rows=db(db.node.id==request.args(0)).select(db.node.ALL)

 where id is of type integer and not string. What is the difference
 between the first use request.args(0) and the second use?


 Kind regards,

 Annet.