私のGAEアプリではwebapp2.RequestHandler.initialize
、リクエストに対してカスタムを行うために使用します。
数日前までの変更os.environ['PATH_INFO']
は、RequestHandler での self.request.path の呼び出しに影響を与え、変更されたリクエスト パスを反映していました。(そして、これは SDK でも問題なく動作します)
今はもう機能しません。もちろん、それが原因で大きな問題を抱えています。これが特殊なケースである可能性があることは理解していますが、これが変更された理由は何ですか?
影響を受けるコード:
class BaseHandler(webapp2.RequestHandler):
def initialize(self, request, response):
ns, path = get_namespace(os.environ)
namespace_manager.set_namespace(ns)
os.environ['namespace'] = ns
# request.path reflects the incoming path
path = os.environ.get('PATH_INFO')
prefix = '/%s'%ns
if ns and path.startswith(prefix):
# the request.path has to be changed here...
newpath = path[len(prefix):]
# here i change the path_info in os.environ to the new
# path
os.environ['PATH_INFO'] = newpath or '/'
super(BaseHandler, self).initialize(request, response)
# request.path and self.request.path here are still unchanged.
# up to a few days ago here the path was reflecting the changes