Django

Code

Ticket #3187 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

[patch] allow middleware to override the URL configuration

Reported by: Fredrik Lundh <fredrik@pythonware.com> Assigned to: adrian
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Here's a simple patch that lets you use different URL configurations for each request. This allows you to use middleware components to switch between different configurations based on hostname:

http://effbot.org/zone/django-multihost.htm

or otherwise provide different views of the site, based on some characteristic of the request.

Attachments

urlconf.diff (0.7 kB) - added by Fredrik Lundh <fredrik@pythonware.com> on 12/25/06 06:37:28.

Change History

12/25/06 06:37:28 changed by Fredrik Lundh <fredrik@pythonware.com>

  • attachment urlconf.diff added.

12/25/06 06:39:39 changed by Fredrik Lundh <fredrik@pythonware.com>

  • summary changed from allow middleware to override the URL configuration to ]patch] allow middleware to override the URL configuration.

(adding an urlconf class attribute to the Request base class would also be a good idea, of course)

12/25/06 06:39:50 changed by Fredrik Lundh <fredrik@pythonware.com>

  • summary changed from ]patch] allow middleware to override the URL configuration to [patch] allow middleware to override the URL configuration.

12/26/06 08:40:34 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

(In [4237]) Fixed #3187 -- Django will now look for the root URLconf as an attribute of the request object, if available. This lets middleware override the urlconf as needed. Thanks, Fredrik Lundh.


Add/Change #3187 ([patch] allow middleware to override the URL configuration)




Change Properties
Action