I'm kicking off a threaded process.  As part of the "run" method, I'm
calling: env("application", import_models=True) in order to work with
the web2py environment inside the context of my thread.  As a result,
models are parsed and the following exception is raised:

Traceback (most recent call last):
  File ".../web2py/gluon/restricted.py", line 188, in restricted
    exec ccode in environment
  File "applications/app/models/db.py", line 32, in <module>
    auth = Auth(globals(), db)
  File ".../web2py/gluon/tools.py", line 804, in __init__
    self.settings.login_url = self.url('user', args='login')
  File ".../web2py/gluon/tools.py", line 762, in url
    f=f, args=args, vars=vars)
  File ".../web2py/gluon/html.py", line 228, in _URL
    return URL(*args, **kwargs)
  File ".../web2py/gluon/html.py", line 206, in URL
    return XML(rewrite.filter_out(url, env))
  File ".../web2py/gluon/rewrite.py", line 183, in filter_out
    if thread.routes.routes_out:
AttributeError: 'thread._local' object has no attribute 'routes'

As soon as URLs are parsed during Auth initialization, the thread hits
a case where an invalid "routes" attribute is dereferenced within
rewrite.py.  My threaded code was working until the following change
was rolled into 1.84.x: "moved DAL and routes to thread.local"

Reply via email to