ERROR on Request

38 views
Skip to first unread message

Maurice Waka

unread,
Feb 18, 2020, 10:58:10 AM2/18/20
to web2py-users
In py4web, I cant use this syntax:
default = request.now


Error:

    Field('modified_on', 'datetime', default=request.now),# update=request.now),
NameError: name 'request' is not defined

Maurice Waka

unread,
Feb 18, 2020, 11:13:27 AM2/18/20
to web2py-users
Thanks @Lovdie

got 


from py4web import request,....

Maurice Waka

unread,
Feb 18, 2020, 11:34:51 AM2/18/20
to web2py-users
BUT 
Now I get this:

Field('modified_on', 'datetime', default=request.now, update=request.now),
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1400, in __getattr__
    raise AttributeError('Attribute %r not defined.' % name)
AttributeError: Attribute 'now' not defined.

Massimo Di Pierro

unread,
Feb 20, 2020, 10:58:02 PM2/20/20
to web2py-users
in py4web request is the bottlepy request.
There is no now.

You can use datetime.timetime.now()

Lovedie JC

unread,
Feb 22, 2020, 12:36:20 AM2/22/20
to web...@googlegroups.com
Thanks.
I switched to it. 
Regards 

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/ebc49b2d-ed20-4fd9-9aa0-ee94a7f4cfde%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages