Now I understand better. You cannot pass vars to linkto. That is by design 
because in principle, the linkto function may need parameters specified by 
the SQLFORM.

On Thursday, 20 February 2014 04:17:47 UTC-6, mcamel wrote:
>
> Hi,
>
> I've seen an unexpected 'SQLTABLE linkto' behaviour (both at 2.8.2 and 
> trunk version):
>
> In a controller:
>
> def sqltablelinkto():
>     
>     db = DAL('sqlite:memory:')
>     db.define_table('parent',Field('name'))
>     db.parent.insert(name='Parent1')
>     db.parent.insert(name='Parent2')
>     
>     l = URL('')
>     
>     return CAT(H5('request.args=%s' % request.args),
>                H5('request.vars=%s' % request.vars),
>                SQLTABLE(db(db.parent).select(), linkto=l))
>
> This works as expected when you click at the id links: name of table and 
> id of record are passed to args, and nothing to vars. URLs are formed like 
> this: http://.../sqltablelinkto/parent/1
>
> But if you want to pass something in vars, things get weird.
> Change the url line to:
>
> l = URL('', vars=dict(data='data in vars'))
>
> Now, when you click at the id links, you get NOTHING at request.args, and 
> all the info is mixed up at request.vars: 'data': 'data in vars/parent/1'
>
> The formed url shows the 
> reason: http://.../sqltablelinkto?data=data+in+vars/parent/1
> I expected this url to be formed: 
> http://.../sqltablelinkto/parent/1?data=data+in+vars
> so you'll get args and vars stored properly.
>
> Am i doing something wrong or should i open a bug ticket?.
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to