summaryrefslogtreecommitdiff
path: root/django/views/decorators/http.py
AgeCommit message (Collapse)Author
2026-01-31Refs #34118 -- Removed asgiref coroutine detection shims.Jacob Walls
As Python 3.12 is now the floor, we can drop the shims and use the `inspect` module.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-06-26Refs #31949 -- Made http decorators to work with async functions.th3nn3ss
2023-05-26Optimized @condition decorator a bit.Mariusz Felisiak
This removes unnecessary get_last_modified() hook.
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-05-12Fixed #32366 -- Updated datetime module usage to recommended approach.Nick Pope
- Replaced datetime.utcnow() with datetime.now(). - Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp(). - Replaced datetime.utctimetuple() with datetime.timetuple(). - Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
2020-09-14Fixed #31789 -- Added a new headers interface to HttpResponse.Tom Carrick
2018-05-04Fixed #26688 -- Fixed HTTP request logging inconsistencies.Samir Shah
* Added logging of 500 responses for instantiated responses. * Added logging of all 4xx and 5xx responses.
2017-11-14Fixed #28795 -- Removed 'not in' checks and used dict.setdefault().Дилян Палаузов
2017-06-06Fixed #28104 -- Prevented condition decorator from setting ↵Josh Schneier
ETag/Last-Modified headers for non-safe requests.
2017-01-21Refs #23919 -- Removed django.utils.decorators.available_attrs() usage.Tim Graham
It's only needed to workaround a bug on Python 2.
2016-11-14Fixed E305 flake8 warnings.Ramin Farajpour Cami
2016-09-10Fixed #27083 -- Added support for weak ETags.Kevin Christopher Henry
2016-09-09Normalized spelling of ETag.Tim Graham
2016-04-08Fixed E128 flake8 warnings in django/.Tim Graham
2015-12-31Removed British/Austrialian word: whilist.Tim Graham
2015-08-15Fixed #24935 -- Refactored common conditional GET handling.Denis Cornehl
2015-05-25Fixed typos in HTTP decorator docs.I am Clinton
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-24Fixed #22461 -- Added if-unmodified-since support to the condition decorator.Thomas Tanner
2014-10-21Fixed #23695 -- Made condition decorator work for HEAD requests without ETag.Anton Novosyolov
2013-11-02Correct flake8 E302 violationsRay Ashman Jr
2013-10-10Whitespace cleanup.Tim Graham
* Removed trailing whitespace. * Added newline to EOF if missing. * Removed blank lines at EOF. * Removed some stray tabs.
2012-09-20Imported getLogger directly from logging moduleClaude Paroz
This was a remainder of some 2.4 compatibility code.
2012-02-09Fixed #17358 -- Updated logging calls to use official syntax for arguments ↵Jannis Leidel
instead of string interpolation. Thanks, spulec. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17480 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-09Fixed #15840 -- Wrapped inner function of the condition decorator with ↵Jannis Leidel
functools.wraps to follow best practices. Thanks, zsiciarz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for ↵Jannis Leidel
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-05-01Replaced old-style with new-style decorator syntax.Jannis Leidel
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-28Fixed #15637 -- Added a require_safe decorator for views to accept GET or ↵Jannis Leidel
HEAD. Thanks, aaugustin and Julien. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16115 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28Removed a bunch more Python 2.4 workarounds now that we don't support that ↵Adrian Holovaty
version. Refs #15702 -- thanks to jonash for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-01Fixed #717 - If-Modified-Since handling should compare dates according to ↵Luke Plant
RFC 2616 Thanks to Maniac for the report, julienb for the initial patch, and especially to aaugustin for the final patch and tests. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-06Fixed #14406 -- Added a Python 2.4 compatibility to the logging interface. ↵Russell Keith-Magee
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-04Fixed #12012 -- Added support for logging. Thanks to Vinay Sajip for his ↵Russell Keith-Magee
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-05-04Fixed #12164 -- Removed the Python 2.3 compatibility imports and ↵Russell Keith-Magee
workarounds. Thanks to timo and claudep for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-12Fixed #13093 -- Updated some decorators and the decorator_from_middleware ↵Russell Keith-Magee
function to allow callable classes to be decorated. Thanks to Brian Neal for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12762 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-03Fixed #10681 -- Work around (by ignoring) invalid ETag headers.Malcolm Tredinnick
This is a hack to work around problems in the Real World. Apparently, Opera 9.64 has been observed sending malformed headers. We now compromise our high principles and simply ignore such bad behaviour. Patch from Ivan Sagalaev. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10370 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24A bunch of improvements for conditional HTTP processing.Malcolm Tredinnick
Fixed some typos in the code (fixed #10586). Added more tests. Made the tests compatible with Python 2.3. Improved the documentation by putting the good news and common use-case right up front. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22Fixed #10581 -- Fixed conditional handling of If-Match headers.Malcolm Tredinnick
The conditional processing decorator from r10114 wasn't parsing ETags from an If-Match header correctly. Patch from Ivan Sagalaev (who also did most of the work in r10114, before I rewrote parts of it and added bonus bugs, although I forgot to thank him there). git-svn-id: http://code.djangoproject.com/svn/django/trunk@10116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-22Fixed #5791 -- Added early-bailout support for views (ETags and Last-modified).Malcolm Tredinnick
This provides support for views that can have their ETag and/or Last-modified values computed much more quickly than the view itself. Supports all HTTP verbs (not just GET). Documentation and tests need a little more fleshing out (I'm not happy with the documentation at the moment, since it's a bit backwards), but the functionality is correct. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10114 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-02-25Fixed #5701 -- Fixed decorators to take the name, attributes, and docstring ↵Gary Wilson Jr
of the function they decorate by adding a modified version of the `functools.wraps` function from Python 2.5. `wraps` has been altered to work with Django's `curry` function and with Python 2.3, which doesn't allow assignment of a function's `__name__` attribute. This fixes severaly annoyances, such as the online documentation for template filters served by the admin app. This change is backwards incompatible if, for some reason, you were relying on the name of a Django decorator instead of the function it decorates. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7153 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20Converted request.META['REQUEST_METHOD'] calls to request.method, throughout ↵Adrian Holovaty
the Django codebase git-svn-id: http://code.djangoproject.com/svn/django/trunk@3171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-20Fixed #2185 -- Changed django.views.decorators.http.require_http_methods ↵Adrian Holovaty
decorator to use HttpResponseNotAllowed instead of HttpResponseForbidden git-svn-id: http://code.djangoproject.com/svn/django/trunk@3163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly ↵Adrian Holovaty
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
2005-10-28Fixed #703: added decorators to require that view be called with a given ↵Jacob Kaplan-Moss
HTTP REQUEST_METHOD git-svn-id: http://code.djangoproject.com/svn/django/trunk@1016 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2005-10-09Fixed #580 -- Added mega support for generating Vary headers, including some ↵Adrian Holovaty
view decorators, and changed the CacheMiddleware to account for the Vary header. Also added GZipMiddleware and ConditionalGetMiddleware, which are no longer handled by CacheMiddleware itself. Also updated the cache.txt and middleware.txt docs. Thanks to Hugo and Sune for the excellent patches git-svn-id: http://code.djangoproject.com/svn/django/trunk@810 bcc190cf-cafb-0310-a4f2-bffc1f526a37