Commit Graph

97 Commits

Author SHA1 Message Date
Aymeric Augustin 4e88d106dc Refactored the unmangling of the WSGI environ. 2013-09-07 10:03:50 -05:00
Aymeric Augustin 636860fbfb Moved two WSGI-specific functions to the WSGI handler.
They were defined in base when the mod_python handler used them. See bfcecbff.
2013-09-07 10:03:49 -05:00
Alex Gaynor 3e0eb2d788 Fixed a number of lint warnings, particularly around unused variables. 2013-08-04 09:17:10 -07:00
Loic Bistuer 48ce167d89 Fixed missing initializations in WSGIRequest. Refs #20619 2013-06-26 14:36:25 +07:00
Aymeric Augustin cb86f707a0 Fixed #12747 -- Made reason phrases customizable. 2013-05-19 13:14:54 +02:00
Alex Gaynor ea3a378c22 Added an HTTP status code to Django's WSGI application that was missing (reason unknown). 2013-05-08 12:45:31 -07:00
Julien Phalip 2f81a0ca65 Fixed #20169 -- Ensured that the WSGI request's path is correctly based on the `SCRIPT_NAME` environment parameter or the `FORCE_SCRIPT_NAME` setting, regardless of whether or not those have a trailing slash. Thanks to bmispelon for the review. 2013-04-01 12:04:44 -07:00
Aymeric Augustin f5dbb566ee Fixed #17550 -- Removed a workaround for a bug in flup 1.0.1.
This reverts commit 948a833eb7.

flup appears to be dead, and this fix breaks legitimate uses of Django.

Refs #8490.
2013-03-24 10:57:38 +01:00
Aymeric Augustin acc5396e6d Fixed #19519 -- Fired request_finished in the WSGI iterable's close(). 2012-12-31 12:47:34 +01:00
Aymeric Augustin 1e4a27d087 Fixed #19468 -- Decoded request.path correctly on Python 3.
Thanks aliva for the report and claudep for the feedback.
2012-12-22 13:32:39 +01:00
Claude Paroz 6de6988f99 Fixed #5076 -- Properly decode POSTs with non-utf-8 payload encoding
Thanks daniel at blogg.se for the report and Aymeric Augustin for
his assistance on the patch.
2012-10-30 09:00:32 +01:00
Alex Gaynor 1b096ad773 Removed a function that is already fully implemented by a base class. 2012-10-24 12:49:57 -07:00
Claude Paroz 26ff2be787 Imported getLogger directly from logging module
This was a remainder of some 2.4 compatibility code.
2012-09-20 21:03:24 +02:00
Florian Apolloner 9ca17f883d Replace nested try/finally try/except with try/except/finally. 2012-09-09 13:00:10 +02:00
Claude Paroz ae88e73fa6 Replaced some smart_xxx by force_xxx equivalent
smart_str/smart_text should only be used when a potential lazy
string should be preserved in the result of the function call.
2012-08-30 15:46:16 +02:00
Claude Paroz f8ea12f36b [py3] Removed excessive usage of smart_bytes 2012-08-15 12:13:54 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Claude Paroz 9908201d7f Replaced some byte strings by str() calls
This is a useful trick when Python 2 awaits byte strings and
Python 3 Unicode (regular) strings.
2012-08-03 15:18:13 +02:00
Alex Gaynor e0fce8706d Switch to using context managers for acquiring and releasing locks. 2012-06-23 08:11:15 -07:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Claude Paroz 38408f8007 Marked bytestrings with b prefix. Refs #18269
This is a preparation for unicode literals general usage in
Django (Python 3 compatibility).
2012-05-19 17:43:34 +02:00
Claude Paroz d7dfab59ea Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate
places. StringIO is not available in Python 3.
2012-05-05 21:41:44 +02:00
Adrian Holovaty 61f0aff811 Fixed #14597 -- Added a SECURE_PROXY_SSL_HEADER setting for cases when you're behind a proxy that 'swallows' the fact that a request is HTTPS
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 22:06:06 +00:00
Adrian Holovaty 082cfce185 Negligible typo fix in a comment in handlers/wsgi.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17207 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 20:21:16 +00:00
Carl Meyer 145a77edc9 Fixed #16360 -- Added WSGI entrypoint to startproject layout, and enabled internal servers (runserver and runfcgi) to use an externally-defined WSGI application. Thanks to Armin Ronacher, Jannis Leidel, Alex Gaynor, ptone, and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-22 04:30:10 +00:00
Jacob Kaplan-Moss 4584069c8a Fixed #16746 - added more HTTP code/string mappings.
This moves the arbitrary line on which HTTP codes to include away from
RFC 2616 and to the IANA assignments, thus picking up WebDAV and a couple
others.

Thanks to vfaronov for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-09 16:57:35 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Jannis Leidel a6cd78662e Fixed #15785 -- Stopped HttpRequest.read() from reading beyond the end of a wsgi.input stream and removed some redundant code in the multipartparser. Thanks, tomchristie, grahamd and isagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16479 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-28 10:17:56 +00:00
Luke Plant db2f9bfae1 Fixed #16178 - Cleanup request classes' `__repr__()`
Thanks to julien for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16350 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-09 23:15:42 +00:00
Jannis Leidel 12265410ac Fixed #15672 -- Refined changes made in r15918. Thanks, vung.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-22 12:15:52 +00:00
Adrian Holovaty 2f9658fc3a Fixed #15672 -- Fixed bug in core/handlers/wsgi.py where we were referring to the 'request' variable before assigning to it. Thanks for the report, vkryachko
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-26 03:53:37 +00:00
Russell Keith-Magee b4f0921463 Fixed #15018 -- Corrected the handling of LimitedStream under one edge case involving size restricted buffers and newlines. Thanks to xjdrew for the report, and aaugustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-16 07:31:35 +00:00
Russell Keith-Magee 0d70d29227 Corrected r15205 syntax to be Python2.4 compatible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15210 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-15 05:54:55 +00:00
Andrew Godwin ba585a2c6d Fixed #11193 -- WSGI handler not properly handling lock on error in load_middleware. Thanks to Phillip Sitbon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-14 23:18:21 +00:00
Russell Keith-Magee c906b270f5 Fixed #14602 -- Added an extra check to wsgi.input handling to prevent AppEngine from choking. Thanks to Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04 12:03:38 +00:00
Russell Keith-Magee 269e921756 Fixed #9886 -- Added a file-like interface to HttpRequest. Thanks to Ivan Sagalaev for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 16:39:25 +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 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
Malcolm Tredinnick d01c17e81d Fixed #9469 -- Apply the fix from r9189 to the WSGI handler as well.
This is a defensive encoding fix. No functionality change for correct URLs.
Patch from magneto.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:58:40 +00:00
Jacob Kaplan-Moss 15644cb255 Fixed #8622: accessing POST after a POST handling exception no longer throws the server into an infinite loop. Thanks to vung for tracking this one down and fixing it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-30 19:56:14 +00:00
Malcolm Tredinnick 948a833eb7 Fixed #8490 -- Worked around a bug in flup 1.0.1 when working out the correct
path_info setting in the WSGI handler. Thanks, Mike Richardson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 02:42:39 +00:00
Malcolm Tredinnick 77bf14d581 Fixed #8259 -- Handle an error situation that we should never see, but still
occurs for some reason (be liberal in what you accept, and all that). Patch
from kevin.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 18:08:28 +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 c236874c48 Fixed #7871 -- Added some more bullet-proofing in PATH_INFO determination,
since Django would like it to at least contain a '/' (rather than being an
empty string).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 22:13:56 +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 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
Jacob Kaplan-Moss d725cc9734 Fixed #2070: refactored Django's file upload capabilities.
A description of the new features can be found in the new [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-01 15:10:51 +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