PY4WEB request.vars error

64 views
Skip to first unread message

Maurice Waka

unread,
Feb 23, 2020, 4:30:29 PM2/23/20
to web2py-users
New issue with py4web.

Whats the new code for request.vars??

I get this error:


Traceback (most recent call last):
 
File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 1397, in __getattr__
 
var = self.environ['bottle.request.ext.%s'%name]
KeyError: 'bottle.request.ext.vars'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 
File "/home/maurice/py4web/py4web/core.py", line 551, in wrapper
 ret
= func(*func_args, **func_kwargs)
 
File "/home/maurice/py4web/py4web/core.py", line 512, in wrapper
 ret
= func(*args, **kwargs)
 
File "apps/_scaffolds/controllers.py", line 86, in index
 
if request.vars:
 
File "/home/maurice/.local/lib/python3.6/site-packages/bottle.py", line 1400, in __getattr__
 
raise AttributeError('Attribute %r not defined.' % name)
AttributeError: Attribute 'vars' not defined.

Val K

unread,
Feb 23, 2020, 6:17:22 PM2/23/20
to web2py-users
p4web `request` is bottle request, see https://bottlepy.org/docs/dev/api.html#bottle.Request 

Maurice Waka

unread,
Feb 24, 2020, 10:11:02 AM2/24/20
to web2py-users
Hi 
I can't make a head or tail out of this.
What changed from e.g. 'request.vars.messag'?
DO you have any example I can use?
Regards

Ruslan Gareev

unread,
Feb 24, 2020, 10:52:46 AM2/24/20
to web2py-users
Hi!

Now in py4web it will be (if POST vars):
request.forms.message or request.POST.message

or if GET vars:
request.query.message or request.GET.message


понедельник, 24 февраля 2020 г., 20:11:02 UTC+5 пользователь Maurice Waka написал:

Massimo Di Pierro

unread,
Feb 28, 2020, 1:17:14 AM2/28/20
to web2py-users
Or request.json() to for content-type: application/json. That's what I use the most in POST
Reply all
Reply to author
Forward
0 new messages