Hi,

I've just tried to submit a small patch to Django using there website,
but I've got a stupid error:

"Internal Error
Akismet rejected spam"

What's going on? Here what I wanted to submit:


[patch] Changing request.path in middleware doesn't affect url
resolver.

When process_request() function in middleware is changing the
request.path, the URL resolver doesn't see the changes.

Currently the function get_response() of BaseHandler gets two
parameters: path and request. I don't know the reason, It could just
use request.path - it would be much simplier and the middleware
modyfications should work then.

I've modified the function itself, and two places from which it is
called (modpython.py and wsgi.py).



And the .patch file, which I was going to atteched latter on:

Index: django/core/handlers/base.py
===================================================================
--- django/core/handlers/base.py        (revision 3706)
+++ django/core/handlers/base.py        (working copy)
@@ -48,7 +48,7 @@
             if hasattr(mw_instance, 'process_exception'):
                 self._exception_middleware.insert(0,
mw_instance.process_exception)

-    def get_response(self, path, request):
+    def get_response(self, request):
         "Returns an HttpResponse object for the given HttpRequest"
         from django.core import exceptions, urlresolvers
         from django.core.mail import mail_admins
@@ -62,7 +62,7 @@

         resolver = urlresolvers.RegexURLResolver(r'^/',
settings.ROOT_URLCONF)
         try:
-            callback, callback_args, callback_kwargs =
resolver.resolve(path)
+            callback, callback_args, callback_kwargs =
resolver.resolve(request.path)

             # Apply view middleware
             for middleware_method in self._view_middleware:
Index: django/core/handlers/modpython.py
===================================================================
--- django/core/handlers/modpython.py   (revision 3706)
+++ django/core/handlers/modpython.py   (working copy)
@@ -133,7 +133,7 @@
         dispatcher.send(signal=signals.request_started)
         try:
             request = ModPythonRequest(req)
-            response = self.get_response(req.uri, request)
+            response = self.get_response(request)

             # Apply response middleware
             for middleware_method in self._response_middleware:
Index: django/core/handlers/wsgi.py
===================================================================
--- django/core/handlers/wsgi.py        (revision 3706)
+++ django/core/handlers/wsgi.py        (working copy)
@@ -145,7 +145,7 @@
         dispatcher.send(signal=signals.request_started)
         try:
             request = WSGIRequest(environ)
-            response = self.get_response(request.path, request)
+            response = self.get_response(request)

             # Apply response middleware
             for middleware_method in self._response_middleware:


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

Reply via email to