On Jun 17, 1:28 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've come across some inconsistent behavior when running django under
> different conditions. This is in some existing code that has has some
> problems and isn't really well written, so I'm going to ask the question
> here first to avoid noise on trac before I raise a ticket.
>
> In this code there's a context processor that checks the path (uri) of the
> request and adds something if it's equal to a certain value. The code is:
> if request.META['PATH_INFO'] == <something>:
>
> Under fastcgi, and runserver this is fine and we only noticed as we started
> to migrate to mod_python. It would appear that request.META['PATH_INFO'] is
> always equal to '/' when running under mod_python. I've fixed it by changing
> the code to check request.path, which seems to work.
>
> Questions then:
> 1) Is it better to use 'PATH_INFO' or .path (I'm guessing the latter).
> However ticket 285 <http://code.djangoproject.com/ticket/285> refers to
> inconsistent behaviour WRT self.path in the WSGI environment.
> 2) Is it a bug in django.core.handlers.modpython.ModPythonRequest to set
> META['PATH_INFO'] to self._req.path_info rather than self.path?
> 3) Does this need a ticket or is the use of request.META['PATH_INFO']
> discouraged? (django's documentation would suggest the use of request.path)
When using mod_python, you cannot rely on req.path_info/PATH_INFO
being set in the traditional way that PATH_INFO would be for CGI
scripts.
If you need this functionality with Apache with mod_python like
feature of embedding, you would have to use mod_wsgi.
If mounting Django application at non root URL, do take heed though of
issues with Django and SCRIPT_NAME/PATH_INFO as described in:
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---