, web2py.
def FirstAjax():
session.forget(response)
[rest of code]
Web2py conversations do not block session files, so a second ajax can begin immediately. Another way is to install:
session.connect(request, response, db)
in your models, this means that the session will not be saved in files, but in your DAL "db", so that the session will not be blocked.
These two solutions are the same for what I need.
In my case, I also need to release the device when the "Back" button is pressed, just added a flag that needs to be checked in the polling cycle, for example:
def FirstAjax():
session.forget(response)
HSCAN.SetLeave(False)
HSCAN.PollingCycle()
def SecondAjax():
HSCAN.SetLeave(True)
class myHandScanner():
def __init__(self):
self.leave = False
def SetLeave(self, leave):
self.leave = leave
def PollingCycle(self):
while True:
if self.leave:
return
if something is read:
val = something
break
return val
Thanks to everyone and hope this helps!
source
share