I'm trying to use uri_for to generate URIs but I have scripts that run outside
the context of a request. These scripts crash like this:
/python/lib/webapp2-2.5.2/webapp2.py", line 1731, in uri_for
request = _request or get_request()
/python/lib/webapp2-2.5.2/webapp2.py", line 1719, in get_request
assert getattr(_local, 'request', None) is not None, _get_request_error
AssertionError: Request global variable is not set.
I was wondering why a URL-building function would even depend on request
context in the first place and found this:
if full or scheme or netloc:
netloc = netloc or request.host
scheme = scheme or request.scheme
Seems like a very trivial thing relative to the dependency it adds.
I suggest making request optional in Route.build and being tolerant to its
absence.
Original issue reported on code.google.com by d...@desmondbrand.com on 4 Jul 2014 at 12:36
Original issue reported on code.google.com by
d...@desmondbrand.com
on 4 Jul 2014 at 12:36