On 1 Aug 2012, at 8:42 AM, Massimo Di Pierro <[email protected]> wrote:
> in trunk. please check it.
Per my earlier message, this should not be necessary. There must be something
else wrong, and str() unfortunately just papers over whatever the real problem
is.
>
> On Wednesday, 1 August 2012 10:23:11 UTC-5, AbrahamLinksys wrote:
> Hi,
>
> I have an appilcation that has been running for a while, and suddenly today
> it gave an error on this line in my view:
>
>
> [<a href="{{=URL(r=request,args=request.args,vars=dict(all=1)) }}">show all
> attachements</a>]
>
> This worked fine, but then I think I upgraded from 1.99.4 to 1.99.7, and it
> throws an error complaining that it cannot concatenate string and int types
> (because of dict(all=1) instead of all='1')
>
> Of course, the error can be fixed by passing a string literal or calling
> str() on the int, but i was curious if this intended?
>
> I haven't been very careful to only use string vars, assuming that my
> laziness would be corrected by some gluonic magic.
>
> Am I supposed to have always been passing only strings as vars? Should I be
> proactive and hunt down places in my code in other applications (which are
> still using slightly older web2py versions) or is this something that might
> change back to being able to use integers?
>
> Just curious. Here's the relevant part of the traceback:
>
> File "/usr/web2py-latest/gluon/html.py", line 330, in URL
> other += '?%s' % '&'.join([var[0]+'='+var[1] for var in list_vars])
> TypeError: cannot concatenate 'str' and 'int' objects
>
> If the "other+=" line were rewritten as such, would it be a bad thing for any
> reason?
> other += '?%s' % '&'.join([str(var[0])+'='+str(var[1]) for var in
> list_vars])
>
> Thanks,
> Abe
>
> --
>
--