Commit Graph

34 Commits

Author SHA1 Message Date
Malcolm Tredinnick 3ee3d6b5f3 Fixed #5898 -- Changed a few response processing paths to make things harder to get wrong and easier to get right. Previous behaviour wasn't buggy, but it was harder to use than necessary.
We now have automatic HEAD processing always (previously required ConditionalGetMiddleware), middleware benefits from the Location header rewrite, so they can use relative URLs as well, and responses with response codes 1xx, 204 or 304 will always have their content removed, in accordance with the HTTP spec (so it's much harder to indavertently deliver invalid responses).

Based on a patch and diagnosis from regexbot@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-11 03:55:44 +00:00
Malcolm Tredinnick 4b610f42d3 Added a get_host() method to HttpRequest. There is still an http.get_host() version in place, so this is fully backwards compatible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 17:46:03 +00:00
Malcolm Tredinnick 8d3d5a37b4 Fixed #5109 -- Pass the request object to any exception signal handler. Thanks, Collin Anderson.
This is fully backwards compatible, despite the addition of an extra argument.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6292 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-15 16:34:41 +00:00
Jacob Kaplan-Moss 4100eab823 Fixed the breakage in [6164] in a different, better way: HttpResponse now implements __contains__ along with __get/set/delitem__, as it should. This is a bit more robust, and should prevent similar breakage from user code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6221 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 21:41:48 +00:00
Jacob Kaplan-Moss 06f4c38b55 Case-insensitive HttpResponse headers ([6212]) broke absolute URL redirects ([6164]); this fixes the breakage.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6219 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 21:36:39 +00:00
Malcolm Tredinnick e70d7e6064 Fixed #987 -- Convert relative URI portions into absolute URIs in HTTP Location headers. Based on a patch from SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6164 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 05:28:00 +00:00
Jacob Kaplan-Moss a5d3e0c3ef 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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-12-26 14:40:33 +00:00
Adrian Holovaty e1d23323b6 Fixed small bug in 'The view ____ didn't return an HttpResponse object' message -- it assumed the view was a function, whereas it can be any callable object
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-28 22:58:10 +00:00
Adrian Holovaty 41d11a685f Fixed #2968 -- Changed arguments to __import__ to use empty dictionary instead of empty string, for stricter compliance with Python library reference. Thanks for the patch, Yasushi Masuda
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3951 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-10-30 20:50:27 +00:00
Adrian Holovaty c0127f015b Folded BaseHandler.get_technical_error_response() into BaseHandler.get_response() to save the overhead of a function call, and because that logic didn't need to be abstracted.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3879 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-28 02:37:41 +00:00
Adrian Holovaty f22cd4ec05 Folded BaseHandler.get_friendly_error_response() into BaseHandler.get_response() to save the overhead of a function call, and because that logic didn't need to be abstracted.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-28 02:34:48 +00:00
Adrian Holovaty 15e7805ae4 Changed BaseHandler.get_response() to take a single parameter (an HttpRequest object) rather than a URL and the HttpRequest object, which is redundant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-28 01:56:02 +00:00
Jacob Kaplan-Moss 17d0bd1512 Fixed a bunch of spurious imports, typos, and other small errors turned up by a pass through PyFlakes. This covers about the first third of the errors.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-21 17:11:13 +00:00
Adrian Holovaty 2abfd5dd58 Fixed #2109 -- Convert old-style classes to new-style classes throughout Django. Thanks, Nicola Larosa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 05:00:13 +00:00
Adrian Holovaty 374d02e598 Fixed #1023 -- Base handler no longer calls mail_admins() on SystemExit, in case of forked processes called from views. Thanks, Hugo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2990 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-26 17:30:40 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00
Adrian Holovaty 8ac114c017 Removed unneeded 'import sys' from base.py handler
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-04-11 03:30:10 +00:00
Adrian Holovaty 51a6d81d72 Fixed #1551 -- Improved base handler to not lose track of important exception in case of exceptions within repr(). Thanks, Ned
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2667 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-04-11 03:29:01 +00:00
Adrian Holovaty f86004a4d3 Fixed #1376 -- Undid [2358], which broke flatpages. Thanks, Tom Tobin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-02-20 04:36:17 +00:00
Adrian Holovaty 2c443df341 Fixed #894 -- Moved response middleware call to base.py so that exceptions in that middleware get processed by the standard exception handling. As a nice side effect, this cuts down on a bit of redundant code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2358 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-02-18 23:41:17 +00:00
Adrian Holovaty cc3660c07d Fixed #878 -- URLconf regex captures no longer have to be named groups. Old URLconfs (with named groups) still work. This is backwards-incompatible if you've defined custom middleware with a process_view function. See http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-27 22:08:51 +00:00
Adrian Holovaty 1663623fad Fixed grammar error in error message from [1355]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1356 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-22 19:41:43 +00:00
Adrian Holovaty b58c820558 Fixed #879 -- Middleware loader now throws a better error for MIDDLEWARE_CLASSES value without a dot. Thanks, Noah Slater
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-22 19:41:09 +00:00
Jacob Kaplan-Moss 0710243ea1 Added "pretty" error pages to be used when DEBUG is True.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1233 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-11-14 17:44:50 +00:00
Adrian Holovaty 5c3d1ec163 Fixed #677 -- db.queries is now reset per request. Thanks, seancazzell
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-25 01:51:57 +00:00
Adrian Holovaty 079752fe88 Fixed #641 -- Fixed re-raise in django.core.handlers.base. Thanks, Sune
git-svn-id: http://code.djangoproject.com/svn/django/trunk@949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-19 01:16:57 +00:00
Adrian Holovaty a2e26150b7 Fixed #616 -- Added a process_exception() hook to middleware framework. Thanks, Hugo
git-svn-id: http://code.djangoproject.com/svn/django/trunk@880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-15 02:20:35 +00:00
Adrian Holovaty cb6aa1035b Fixed #407 -- Code no longer assumes request.META['REMOTE_ADDR'] exists. Thanks, sune.kirkeby@gmail.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-31 16:27:59 +00:00
Adrian Holovaty aec0a73d73 Changed 'coding error' and 'database error' e-mails to include request.path in subject
git-svn-id: http://code.djangoproject.com/svn/django/trunk@548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-25 00:50:01 +00:00
Adrian Holovaty 28d41fe270 Tweaked [531] slightly, so that it checks for 'is None' instead of boolean 'not'
git-svn-id: http://code.djangoproject.com/svn/django/trunk@532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-18 00:15:39 +00:00
Adrian Holovaty 8a939224fa Added friendly error message if a view returns None instead of an HttpResponse object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@531 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-18 00:14:15 +00:00
Adrian Holovaty 59c3ebc6dd Greatly improved the 404 error message when DEBUG=True. If none of the urlpatterns matches, Django now displays a list of all the urlpatterns it tried. This should catch a lot of newbie errors, and it's helpful even for power users.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@414 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-05 22:22:41 +00:00
Adrian Holovaty a55598cbdd Refactored the internals of URL parsing to use less code
git-svn-id: http://code.djangoproject.com/svn/django/trunk@411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-08-05 20:50:19 +00:00
Adrian Holovaty c97efb6799 Fixed #63 -- Refactored django.core.handlers into subclasses to remove duplicate code
git-svn-id: http://code.djangoproject.com/svn/django/trunk@298 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-07-22 18:34:38 +00:00