As far as I understand, you are not using Auth, so why are you defining 
auth = Auth(...) at all? Just get rid of that line.

On Thursday, June 22, 2017 at 1:06:05 AM UTC-4, T.R.Rajkumar wrote:
>
> I put the below  code in my model file amc.py
>
> from gluon.storage import Storage
> from gluon.utils import web2py_uuid
> if not 'auth' in session:
>     session.auth = Storage(hmac_key=web2py_uuid())
>
> But now when in run http://127.0.0.1:8000/web_ocms/amc/new_contract I get 
> this error.
>
> Error ticket for "web_ocms" Ticket ID 
>
> 127.0.0.1.2017-06-22.10-26-57.a604f48d-7432-4cf3-b628-81168a796052
> <type 'exceptions.TypeError'> unsupported type for timedelta seconds 
> component: NoneType Version 
> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
> Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
>
> Traceback (most recent call last):
>   File "D:\web2py\gluon\restricted.py", line 227, in restricted
>     exec ccode in environment
>   File "D:/web2py/applications/web_ocms/models/db.py" 
> <http://127.0.0.1:8000/admin/default/edit/web_ocms/models/db.py>, line 86, in 
> <module>
>     auth = Auth(db, host_names=myconf.get('host.names'))
>   File "D:\web2py\gluon\tools.py", line 1766, in __init__
>     delta = datetime.timedelta(days=0, seconds=auth.expiration)
> TypeError: unsupported type for timedelta seconds component: NoneType
>
> Error snapshot [image: help] 
> <http://127.0.0.1:8000/admin/default/ticket/web_ocms/127.0.0.1.2017-06-22.10-26-57.a604f48d-7432-4cf3-b628-81168a796052#>
>  
>
> <type 'exceptions.TypeError'>(unsupported type for timedelta seconds 
> component: NoneType) 
>
> inspect attributes 
> Frames 
>    
>    - 
>    
>    *File D:\web2py\gluon\restricted.py in restricted at line 227* code 
>    arguments variables 
>    - 
>    
>    *File D:\web2py\applications\web_ocms\models\db.py in <module> at line 
>    86* code arguments variables 
>    - 
>    
>    *File D:\web2py\gluon\tools.py in __init__ at line 1766* code arguments 
>    variables 
>    Function argument list 
>    
>    (self=<gluon.tools.Auth object>, environment=<DAL uri="mssql2:******@
>    172.16.164.64\SQLEXPRESS/ocms_nlc">, db=<DAL uri="mssql2:******@
>    172.16.164.64\SQLEXPRESS/ocms_nlc">, mailer=True, hmac_key=None, 
>    controller='default', function='user', cas_provider=None, signature=True, 
>    secure=False, csrf_prevention=True, propagate_extension=None, 
>    url_index=None, jwt=None, host_names=['localhost:*', '127.0.0.1:*', '*:*', 
>    '*'])
>    Code listing 
>    
>    1761.
>    1762.
>    1763.
>    1764.
>    1765.
>    1766.
>    
>    1767.
>    1768.
>    1769.
>    1770.
>    
>            # if we have auth info
>            #    if not expired it, used it
>            #    if expired, clear the session
>            # else, only clear auth info in the session
>            if auth:
>                delta = datetime.timedelta(days=0, seconds=auth.expiration)
>    
>                if auth.last_visit and auth.last_visit + delta > now:
>                    self.user = auth.user
>                    # this is a trick to speed up sessions to avoid many writes
>                    if (now - auth.last_visit).seconds > (auth.expiration / 
> 10):
>    
>    Variables 
>    auth.expiration None 
>    seconds undefined 
>    days undefined 
>    auth <Storage {'hmac_key': '58fb6e67-49ea-4063-986d-8406469f6309'}> 
>    global datetime <module 'datetime' (built-in)> 
>    delta undefined 
>    datetime.timedelta <type 'datetime.timedelta'>
>    
> So now I commented in db.py
> #auth = Auth(db, host_names=myconf.get('host.names'))
>
> After commenting auth the url works. Is this because of the hmac_key ?
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to