Looking at gluon/sqltml.py code i think i realized how 'linkto' works:

   - is a lambda is passed, it's used to generate the href
   - if not, a string is concatenated: href = '%s/%s/%s' % (linkto, 
   tablename, r_old)

The manual says nothing about expecting a lambda, so i figured out you have 
to pass an URL and after that, 'tablename' and 'r_old' were appended 
automatically to the args part. But it's not that way: if you do not pass a 
lambda, you only can pass the name of a function (and then 'tablename' and 
'r_old' are appended at the end).

Knowing that, this code seems to do the trick (replacing the empty string 
with the name of the function to redirect):

l = lambda field, type, ref: URL(f='', args=[ref, field], vars=dict(data='data 
in vars'))

If you agree you can close 1881 ticket. It's not a bug at the code (maybe 
at the manual).

By the way, is it proper to open issues to suggest corrections of the 
manual (i have a few)?.

Thanks.


El martes, 25 de febrero de 2014 23:30:14 UTC+1, Massimo Di Pierro escribió:
>
> 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.
>

-- 
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