you have to use this its working fine :-

def one():
    KEY = 'mykey'
    return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY))
    
def two():
    if not URL.verify(hmac_key=KEY): raise HTTP(403)
    # do something
    return locals()


On Sunday, April 15, 2012 7:33:00 AM UTC+5:30, pyhead wrote:
>
> I copied and pasted the examples for web2py Digitally signed URLs andthey are 
> giving errors on the latest stable build.  
>
> http://www.web2py.com/books/default/chapter/29/4#Digitally-signed-urls
> TypeError: verifyURL() takes at least 1 argument (1 given)
> The error is confusing as it seems to confirm the correct syntax is being 
> used.  hmac_key is undefined, but it shouldn't be.  Any ideas?  Thank you!
> KEY = 'mykey'
>
> def one():
>     return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY)) # added 
> missing ')'
>
> def two():
>     if not URL.verify(hmac_key=KEY): raise HTTP(403)
>     # do something
>     return locals()
>
>
> Error ticket for "init"
> Ticket ID
> 2012-04-12.02-09-19.a3721873-db4c-4ad1-885f-0912f6bd7a53
> <type 'exceptions.TypeError'> verifyURL() takes at least 1 argument (1 given)
> Version
> web2py™     (1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')
> Python        Python 2.7.1: /usr/bin/python
> Traceback
>
> Traceback (most recent call last):
>   File "web2py/gluon/restricted.py", line 205, in restricted
>     exec ccode in environment
>   File "web2py/applications/init/controllers/default.py", line 498, in 
> <module>
>   File "web2py/gluon/globals.py", line 173, in <lambda>
>     self._caller = lambda f: f()
>   File "web2py/applications/init/controllers/default.py", line 79, in two
>     if not URL.verify(hmac_key=KEY): raise HTTP(403)
> TypeError: verifyURL() takes at least 1 argument (1 given)
>
> Error snapshot help
>
> <type 'exceptions.TypeError'>(verifyURL() takes at least 1 argument (1 given))
>
> Frames
>
>     File web2py/gluon/restricted.py in restricted at line 205 code arguments 
> variables
>
>     File web2py/applications/init/controllers/default.py in <module> at line 
> 498 code arguments variables
>
>     File web2py/gluon/globals.py in <lambda> at line 173 code arguments 
> variables
>
>     File web2py/applications/init/controllers/default.py in two at line 79 
> code arguments variables
>     Function argument list
>     ()
>     Code listing
>
>     def one():
>         return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY))
>
>     def two():
>     if not URL.verify(hmac_key=KEY): raise HTTP(403)
>
>         # do something
>         return locals()
>
>     Variables
>     global URL        <function URL>
>     hmac_key  undefined
>     global HTTP       <class 'gluon.http.HTTP'>
>     URL.verify        <function verifyURL>
>     global KEY        'mykey'
>
>

Reply via email to