The string interpolation here:

redirect(URL(c='articles',f='show?id=%s%id'))

is not being performed, so the controller gets ...%s%id as raw string,
and the id argument should evaluate to an integer to return a db
record. So i think that the part of the code that has to replace the
string in the f parameter is missing or is prevented to run by other
instruction.

Instead, this should work:

redirect(URL(c='articles',f='show?id=%s' % myid))

where the expression int(myid) evaluates to an int object

On 12 feb, 08:04, Praveen Bhat <[email protected]> wrote:
> Hello,
>
> I am getting the following error:
>
> <type 'exceptions.ValueError'> invalid literal for int() with base 10:
> '%s%id'
>
> and the code in my controller is:
>
> def show():
> redirect(URL(c='articles',f='show?id=%s%id'))
>
> which redirects to the following function in articles controller:
>
> def show():
> id=request.vars.id
> articles=db(db.article.id==id).select()
> if not len(articles): redirect(URL('articles'))
> return dict(article=articles[0])
>
> Could someone help me out?
>
> Regards
> Praveen

Reply via email to