Even better, just put the URL in a hidden field in the form:
{{=LOAD('default', 'send_suggestion', ajax_trap=True)}}
def send_suggestion():
form = SQLFORM.factory(Field('message', 'text', requires=IS_NOT_EMPTY
()),
hidden=dict(url=XML(URL(args=request.args, vars=request.get_vars))))
if form.process().accepted:
subject = 'FEEDBACK: %s' % request.vars.url
response.flash = 'Thanks for your feedback'
Anthony
On Thursday, May 17, 2012 4:00:02 PM UTC-4, Anthony wrote:
>
> by the way as the request.vars.vars contains "<Storage {'eeee': '5555',
>> 'www': '4'}>" ast.literal_eval(request.vars.vars[9:-1]) did the trick
>>
>
> Sorry, I was thinking dict instead of Storage.
>
>
>> Just wondering if there is an easier way of doing it.... (I mean: to pass
>> the current URL+vars to the LOAD)
>>
>
> How about:
>
> {{=LOAD('default', 'send_suggestion',
> vars=dict(url=URL(args=request.args, vars=request.get_vars)),
> ajax_trap=True)}}
>
> def send_suggestion():
> import urllib
> form = SQLFORM.factory(Field('message', 'text', requires=IS_NOT_EMPTY
> ()))
> if form.process().accepted:
> subject = 'FEEDBACK: %s' % urllib.unquote(request.get_vars.url)
> response.flash = 'Thanks for your feedback'
>
>
> Anthony
>
>