On Wed, Sep 05, Graham Dumpleton wrote:

> 
> On Sep 5, 8:59 pm, Michael Radziej <[EMAIL PROTECTED]> wrote:
> > On Wed, Sep 05, Thomas Guettler wrote:
> >
> > > Am Mittwoch, 5. September 2007 11:27 schrieb Michael Radziej:
> > > > On Wed, Sep 05, Thomas Guettler wrote:
> > > [cut]
> > > > Is this the same problem as in ticket #285?
> >
> > > >http://code.djangoproject.com/ticket/285
> >
> > > Yes
> >
> > Great - Thomas, could you test the patch that is attached to the ticket?
> >
> > Is there a general agreement that the mod_python path is the correct one?
> 
> Be very very cautious about accepting that how mod_python does things
> is correct. This is because the way that mod_python works means that
> it doesn't set SCRIPT_NAME/PATH_INFO correctly most of the time. All
> WSGI adapters for mod_python have to fudge it, by allowing a user to
> say what SCRIPT_NAME should have been and then the WSGI adapter tries
> to then work out what PATH_INFO should have been based on that.
> 
> Since SCRIPT_NAME/PATH_INFO derive from CGI behaviour, you would be
> much better looking at what a CGI script produces and work things out
> from there.
> 
> Alternatively look at what mod_wsgi produces as it correctly mirrors
> what normal CGI would produce for SCRIPT_NAME/PATH_INFO.

Hm, I might have summarized ticket 285. It does also change mod_python
behaviour according what you wrote:

--- django/core/handlers/modpython.py   (revision 5766)
+++ django/core/handlers/modpython.py   (working copy)
@@ -94,7 +94,7 @@
                 'CONTENT_LENGTH':    self._req.clength, # This may be wrong
                 'CONTENT_TYPE':      self._req.content_type, # This may be
                 wrong
                 'GATEWAY_INTERFACE': 'CGI/1.1',
-                'PATH_INFO':         self._req.path_info,
+                'PATH_INFO':         self._req.uri,
                 'PATH_TRANSLATED':   None, # Not supported
                 'QUERY_STRING':      self._req.args,
                 'REMOTE_ADDR':       self._req.connection.remote_ip,

and for wsgi:

--- django/core/handlers/wsgi.py        (revision 5766)
+++ django/core/handlers/wsgi.py        (working copy)
@@ -74,7 +74,8 @@
 class WSGIRequest(http.HttpRequest):
     def __init__(self, environ):
         self.environ = environ
-        self.path = force_unicode(environ['PATH_INFO'])
+        self.path = ''.join((force_unicode(environ.get('SCRIPT_NAME') or
''),
+                             force_unicode(environ['PATH_INFO'])))
         self.META = environ
         self.method = environ['REQUEST_METHOD'].upper()


The patch also stops passing request.path in favour of META['PATH_INFO']:

-- django/core/handlers/base.py (revision 5766)
+++ django/core/handlers/base.py        (working copy)
@@ -65,7 +65,7 @@
 
         resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
         try:
-            callback, callback_args, callback_kwargs =
  resolver.resolve(request.path)
+            callback, callback_args, callback_kwargs =
resolver.resolve(request.META['PATH_INFO'])
 
             # Apply view middleware
             for middleware_method in self._view_middleware:


To me, this looks correct, but could please someone with more expertise than
I have look at this? Graham? Any core developer?

Michael

-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to