How do I solve this error: NameError: name 'person_id' is not defined in KPax2

35 views
Skip to first unread message

Maurice Waka

unread,
Sep 10, 2019, 4:31:11 PM9/10/19
to web2py-users
I'm trying out a surveys app from KPax2/surveys/take_survey..


but got this error:

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Traceback (most recent call last):
File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/mauricewaka/web2py/applications/KPax2/controllers/surveys.py", line 370, in <module>
File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "/home/mauricewaka/web2py/gluon/tools.py", line 3869, in f
return action(*a, **b)
File "/home/mauricewaka/web2py/applications/KPax2/controllers/surveys.py", line 93, in take_survey
survey,sa=thissurvey()
File "/home/mauricewaka/web2py/applications/KPax2/models/db_surveys.py", line 95, in thissurvey
if not has_access(person_id,'survey',survey_id,'take'):#if not has_access(person_id,'survey',survey_id,'take'):
NameError: name 'person_id' is not defined

Was there a table that was not created/defined?
How do I solve this
Kind regards

Dave S

unread,
Sep 11, 2019, 4:04:55 AM9/11/19
to web2py-users
It appears that this is in one of your model files ... does that file tell you what it expects person_id to be or to come from?

"has_access()" sounds like a Flask decorator, based on a quick Google search.

/dps



/dps
 

Lovedie JC

unread,
Sep 11, 2019, 4:50:29 AM9/11/19
to web...@googlegroups.com
I got this from web2py appliances apps.
Just trying it out. 
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/8b37f831-8a82-4d96-b69a-5d9cf74a154c%40googlegroups.com.

Massimo Di Pierro

unread,
Sep 12, 2019, 2:16:08 AM9/12/19
to web2py-users
wow that is a very old app. It has some good ideas but it also has bugs. It was a proof of concept. I believe person_id in that context should be

session.person_id or auth.user.id

But I cannot promise it will work with this change.

Lovedie JC

unread,
Sep 12, 2019, 5:09:14 AM9/12/19
to web...@googlegroups.com
Auth.iser.id works. 
Just the cPickle issues.
Maybe I'll be on and off asking more about 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.

Massimo Di Pierro

unread,
Sep 13, 2019, 12:12:35 AM9/13/19
to web2py-users
Please do. KPax had some good idea. It should be ported to py4web.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages