Django

Code

Ticket #7317 (closed: fixed)

Opened 6 months ago

Last modified 3 months ago

XViewMiddleware should not be enabled by default.

Reported by: anonymous Assigned to: jacob
Milestone: 1.0 Component: Documentation
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 1
Needs tests: 0 Patch needs improvement: 0

Description

The XViewMiddleware is enabled by default and it is causing problems and confusion, see #7299 and http://toofishes.net/blog/django-middleware-order/ , quoting from there: "I don't really know what XView does, so it is last. It isn't that important.".

That's because

  • it is enabled by default AND
  • its purpose is too vaguely defined: Sends custom X-View HTTP headers to HEAD requests that come from IP addresses defined in the INTERNAL_IPS setting. This is used by Django’s automatic documentation system.

The middleware can be safely disabled and should be documented as such. Although I have looked at the source, I fail to see it's purpose for the general public. The only "automatic documenatation" system I have encountered is the context from exception backtraces. *If* it is used there, this should be stated -- "The automatic documentation system is mainly useful to see exception backtrace context in debug mode. You can disable it in production mode."

Please correct me if I'm wrong.

Attachments

Change History

05/28/08 06:55:17 changed by anonymous

  • needs_better_patch changed.
  • component changed from Tools to Documentation.
  • needs_tests changed.
  • needs_docs changed.

05/29/08 03:09:30 changed by mrts

  • needs_docs set to 1.
  • stage changed from Unreviewed to Design decision needed.

Indeed, looks like the XViewMiddleware is not used anywhere internally, perhaps it should not be enabled by default?

$ grep -r XViewMiddleware django/ | egrep -v '(\.svn|\.pyc)'
django/middleware/doc.py:class XViewMiddleware(object):
django/conf/global_settings.py:    'django.middleware.doc.XViewMiddleware',
django/conf/project_template/settings.py:    'django.middleware.doc.XViewMiddleware',
$ grep -r 'X-View' django/ | egrep -v '(\.svn|\.pyc)'
django/middleware/doc.py:    Adds an X-View header to internal HEAD requests -- used by the documentation system.
django/middleware/doc.py:            response['X-View'] = "%s.%s" % (view_func.__module__, view_func.__name__)

06/24/08 04:09:25 changed by mrts

James explains the purpose of XViewMiddleware quite well http://www.b-list.org/weblog/2007/nov/07/bookmarklets/ . Perhaps some of it could be borrowed for documentation.

As nfa has a separate documentation app not enabled by default, XViewMiddleware should also be disabled by default and enabled only if the former is enabled.

08/18/08 05:59:55 changed by mrts

  • milestone set to 1.0 maybe.

Targeting to 1.0-maybe.

08/22/08 18:59:29 changed by jacob

  • owner changed from nobody to jacob.
  • status changed from new to assigned.
  • stage changed from Design decision needed to Accepted.
  • summary changed from XViewMiddleware should be documented better to XViewMiddleware should not be enabled by default..
  • milestone changed from 1.0 maybe to 1.0.

(changed description -- the docs are fine, but it shouldn't be on by default)

08/25/08 07:59:27 changed by jacob

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

Fixed in [8537].


Add/Change #7317 (XViewMiddleware should not be enabled by default.)




Change Properties
Action