Opened 8 years ago

Closed 5 years ago

#7032 closed Cleanup/optimization (needsinfo)

change django.core.handlers.base.get_response to use urlresolvers.resolve

Reported by: Travis Cline Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django.core.handlers.base.get_response looks like it should use urlresolvers.resolve instead of directly instantiating urlresolvers.RegexURLResolver

Index: django/core/handlers/base.py
===================================================================
--- django/core/handlers/base.py        (revision 7425)
+++ django/core/handlers/base.py        (working copy)
@@ -68,9 +68,8 @@
         # Get urlconf from request object, if available.  Otherwise use default.
         urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
 
-        resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
         try:
-            callback, callback_args, callback_kwargs = resolver.resolve(request.path)
+            callback, callback_args, callback_kwargs = urlresolvers.resolve(request.path, urlconf)
 
             # Apply view middleware
             for middleware_method in self._view_middleware:

Change History (7)

comment:1 Changed 8 years ago by Eric Holscher

milestone: 1.0
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by Jacob

Triage Stage: Design decision neededAccepted

comment:3 Changed 8 years ago by Jacob

Is there actually a bug here? Because "looks like it should ..." isn't a good enough reason to change verified working code.

comment:4 Changed 8 years ago by Jacob

Triage Stage: AcceptedDesign decision needed

comment:5 Changed 8 years ago by Jacob

milestone: 1.0

I don't see a bug here, so pushing post-1.0.

comment:6 Changed 5 years ago by Luke Plant

Severity: Normal
Type: Cleanup/optimization

comment:7 Changed 5 years ago by Alex Gaynor

Easy pickings: unset
Resolution: needsinfo
Status: newclosed
UI/UX: unset

I don't see a reason to do this, besides a desire for code churn ;). Closing needsinfo, feel free to reopen if there's a reason I missed.

Note: See TracTickets for help on using tickets.
Back to Top