Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:58:32+00:00 2026-06-04T12:58:32+00:00

in my GAE app i use webapp2.RequestHandler.initialize to do custom stuff to the request.

  • 0

in my GAE app i use webapp2.RequestHandler.initialize to do custom stuff to the request.
up to a few days ago changing os.environ['PATH_INFO'] did influence calling self.request.path on the RequestHandler and it reflected the changed request path.
(and this still works fine on the SDK)

now it does not work any more. and of course im having huge issues because of it.
i understand that this might be an edge case but what are the reasons this changed?

the affected code:

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:58:34+00:00Added an answer on June 4, 2026 at 12:58 pm

    os.environ contains the CGI-style environment variables. WSGI applications such as webapp(2) may get their information from there (or not, depending on the container), but they’re welcome – and even likely – to copy, not reference the original data. There’s no reason to assume that manipulating os.environ will affect your WSGI app, and doing so is a bad idea for several reasons:

    1. It breaks abstraction
    2. It may not be threadsafe
    3. It’s just nasty

    Instead, modify the request object directly (eg, by assigning to request.path), if you must – or better, store the relevant information in attributes on the request handler that your subhandlers can access.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently configured my app to use the new AppStats feature of GAE. However,
There seem to be 2 ways to use django 1.1 with GAE Google App
I'm developing an app for GAE and trying to use Task Queues. At present,
I'm running an app on GAE/J and getting a MemcacheServiceException. I never explicitly use
I'm trying to use sitemesh2.4 for my GAE(struts 1.3, spring 2.5) based app. I
I would like to use Task Queue with my App in GAE . As
My GAE app runs fine from my computer, but when I upload it, I
For my GAE app I need to do some natural language processing to extract
I have a simple GAE app that includes a login/logout link. This app is
I am trying to upload my GAE app using the console in windows. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.