Commit Graph

67 Commits

Author SHA1 Message Date
Russell Keith-Magee f89f1c8acb Fixed #15083 -- Corrected the order of TemplateResponse middleware handling, ensuring that custom URLConfs are valid, and that ResponseMiddleware is invoked if the TemplateResponseMiddleware causes errors. Thanks to Sayane for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-16 15:38:03 +00:00
Russell Keith-Magee e0dcd7666a Fixed #12815 -- Added TemplateResponse, a lazy-evaluated Response class. Thanks to Simon Willison for the original idea, and to Mikhail Korobov and Ivan Sagalaev for their assistance, including the draft patch from Mikhail.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-07 13:57:01 +00:00
Alex Gaynor 96cc7baf0c Fixed #13684 -- if settings.ROOT_URLCONF isn't defined don't blow up with an UnboundLocalError.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-07 16:02:22 +00:00
Russell Keith-Magee 52e0bcbc62 Fixed #14588 -- Corrected r14393 to ensure that response middlewares are are always applied. Includes a battery of tests to validate the expected behavior of the middleware cycle. Thanks to Petr Marhoun for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-30 07:19:04 +00:00
Russell Keith-Magee 3086b55b0e Fixed #14523 -- Modified response handling so that exceptions raised by process_response() in a middleware are caught and handled like any other exception. Thanks to Ivan Sagalaev for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 07:43:56 +00:00
Russell Keith-Magee a904e55859 Fixed #11509 -- Modified usage of "Web" to match our style guide in various documentation, comments and code. Thanks to timo and Simon Meers for the work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 08:12:50 +00:00
Russell Keith-Magee fea159282b Fixed #14406 -- Added a Python 2.4 compatibility to the logging interface. Thanks to Łukasz Rekucki for the report, and to Luke Plant for original patch this was based on.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-06 15:02:26 +00:00
Russell Keith-Magee 24acca4139 Fixed #12012 -- Added support for logging. Thanks to Vinay Sajip for his draft patch, and to the many people who gave feedback during development of the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-04 15:12:39 +00:00
Luke Plant 3e1e04d6d0 Fixed #10758 - sys.exc_info() should not be stored on a local variable
Thanks piotr.findeisen for report, kevinh for patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@13318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-06-03 18:50:04 +00:00
Russell Keith-Magee 667ced2abc Fixed #12594 -- Ensured that a meaningful exception is raised when the urlconf_module is None. Thanks to buriy for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12854 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-26 15:08:24 +00:00
Russell Keith-Magee 794690c272 Fixed #13090 -- Corrected handling of errors in middleware when DEBUG=False. Thanks to EroSennin for the report, and Ivan Sagalaev for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-12 16:45:29 +00:00
Adrian Holovaty 7d9de178e7 Fixed #6094 again -- fixed broken unit tests. Thanks, isagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:48:08 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Adrian Holovaty ca6f64a43f Fixed #6094 -- Middleware exceptions are now caught by the core handler. Thanks, isagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12165 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 17:35:01 +00:00
Brian Rosner 6c61ca3d74 Fixed #5034 -- honor request.urlconf in reverse and resolve.
This enables {% url %} to honor request.urlconf set from process_request
middleware methods.

Thanks SmileyChris for the initial patch work.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-16 01:58:00 +00:00
Jacob Kaplan-Moss b2645a15fd Reverted [10346] because it effectively breaks USE_I18N by forcing import of translation before settings are ready.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 21:58:38 +00:00
Jacob Kaplan-Moss c4f7bf8312 Fixed #9847: mark the permission denied message for translation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 21:46:42 +00:00
Jacob Kaplan-Moss c485e236bd Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 16:55:59 +00:00
Malcolm Tredinnick bd6fc4848e Fixed a problem from r10036. Fixed #10470.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10040 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 07:57:35 +00:00
Malcolm Tredinnick 6483fdf1fa Fixed #10470 -- Fixed a race condition in middleware initialization.
Thanks to Travis Terry and mrts.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-12 07:27:47 +00:00
Russell Keith-Magee e054295fed Fixed #8136: Added a signal emission when an error is raised handling an error. This was required for the test client to handle missing 404.html templates and errors in the 404.html template. Thanks to danfairs for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8464 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 13:59:41 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Malcolm Tredinnick bfcecbffd3 Changed/fixed the way Django handles SCRIPT_NAME and PATH_INFO (or
equivalents). Basically, URL resolving will only use the PATH_INFO and the
SCRIPT_NAME will be prepended by reverse() automatically. Allows for more
portable development and installation. Also exposes SCRIPT_NAME in the
HttpRequest instance.

There are a number of cases where things don't work completely transparently,
so mod_python and fastcgi users should read the relevant docs.

Fixed #285, #1516, #3414.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 07:57:10 +00:00
Malcolm Tredinnick 189c704ae6 Revert [7991] - [7993]. I was committing from the wrong branch. Sorry 'bout
that, folks. :-(


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:37:55 +00:00
Malcolm Tredinnick 99bbaa0090 Allow avoidance of the Apache mod_rewrite undo.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:32:12 +00:00
Malcolm Tredinnick b653cdcfb2 First part of setting request.path correctly.
Still needs:
    - testing
    - docs changes
    - some way of fixing reverse().


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7991 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:32:01 +00:00
Malcolm Tredinnick 795b6a1271 Fixed #7471 -- If the 400 response handler raises an exception, pass control to
the 500 handler (if that then raises an exception, it's just not your day).

Patch from Leah Culver.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7988 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 18:49:49 +00:00
Malcolm Tredinnick 57bb10e6c4 Refactored the HTTP 500 error response creation slightly. Provides the ability
for subclassing that piece of the processing path.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7928 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-15 19:17:49 +00:00
Malcolm Tredinnick 8975bba742 Fixed #4148 -- Changed the way attachments are served to IE to avoid some
caching and header-related bugs there. Only comes into play when Internet
Explorer is the user-agent.

Patch from Michael Axiak, with testing from Axis_of_Entropy and Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-07 01:45:19 +00:00
Luke Plant 8c9fceebb1 Added DEBUG_PROPAGATE_EXCEPTIONS setting that helps testing under e.g. twill
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-05-16 23:24:36 +00:00
Jacob Kaplan-Moss 03ebd159a0 Fixed #4701 -- sys.exit() will no longer get swallowed by the http handler. Slightly backwards compatible, perhaps, but you really shouldn't be sys.exit()ing in view code anyway. Thanks, Bastian Kleineidam.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7168 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-28 01:52:59 +00:00
Malcolm Tredinnick 050b8a436a Fixed #6305 -- Always emit the got_request_exception signal, even when
DEBUG=True. Patch from Collin Anderson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7068 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-03 04:06:35 +00:00
Gary Wilson Jr c882d7c99c Re-organized imports in handler modules to adhere to Django coding style.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 02:22:19 +00:00
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