Sessions and Ajax / Load

35 views
Skip to first unread message

Philip Kilner

unread,
Oct 25, 2019, 7:34:49 AM10/25/19
to web2py-users
Hi.

I am using sessions and Ajax (via web2py's LOAD), and finding that in the main view's code I can call the session as normal, but in the code for the component the session is not accessible and the error messages suggest that it's a local variable: -

UnboundLocalError: local variable 'session' referenced before assignment
How should I address sessions differently under Ajax?
--
Cheers,
PhilK

Ruslan Gareev

unread,
Oct 25, 2019, 1:29:44 PM10/25/19
to web2py-users
In models:
current.session = session


In your component:

from gluon import current
def your_function():
    session
= current.session




пятница, 25 октября 2019 г., 16:34:49 UTC+5 пользователь Philip Kilner написал:
Reply all
Reply to author
Forward
0 new messages