Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #15395 -- Documented the modules/import paths for the v…

…arious decorators in `django.views.decorators`. Thanks to slinkp for the report.

Backport of [15671] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15672 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 32ac8d913e4074da99fe4588c1d0f959f500cd4a 1 parent f5c0328
authored

Showing 1 changed file with 20 additions and 7 deletions. Show diff stats Hide diff stats

  1. 27  docs/topics/http/decorators.txt
27  docs/topics/http/decorators.txt
@@ -2,7 +2,7 @@
2 2
 View decorators
3 3
 ===============
4 4
 
5  
-.. currentmodule:: django.views.decorators.http
  5
+.. module:: django.views.decorators.http
6 6
 
7 7
 Django provides several decorators that can be applied to views to support
8 8
 various HTTP features.
@@ -10,12 +10,16 @@ various HTTP features.
10 10
 Allowed HTTP methods
11 11
 ====================
12 12
 
  13
+The following decorators in :mod:`django.views.decorators.http` can be used to
  14
+restrict access to views based on the request method.
  15
+
13 16
 .. function:: require_http_methods(request_method_list)
14 17
 
15  
-This decorator is used to make a view only accept particular request methods.
16  
-Usage::
  18
+This decorator is used to ensure that a view only accepts particular request
  19
+methods. Usage::
17 20
 
18 21
     from django.views.decorators.http import require_http_methods
  22
+
19 23
     @require_http_methods(["GET", "POST"])
20 24
     def my_view(request):
21 25
         # I can assume now that only GET or POST requests make it this far
@@ -35,6 +39,9 @@ Decorator to require that a view only accept the POST method.
35 39
 Conditional view processing
36 40
 ===========================
37 41
 
  42
+The following decorators in :mod:`django.views.decorators.http` can be used to
  43
+control caching behavior on particular views.
  44
+
38 45
 .. function:: condition(etag_func=None, last_modified_func=None)
39 46
 
40 47
 .. function:: etag(etag_func)
@@ -45,27 +52,33 @@ These decorators can be used to generate ``ETag`` and ``Last-Modified``
45 52
 headers; see
46 53
 :doc:`conditional view processing </topics/conditional-view-processing>`.
47 54
 
48  
-.. currentmodule:: django.views.decorators.http
  55
+.. module:: django.views.decorators.gzip
49 56
 
50 57
 GZip compression
51 58
 ================
52 59
 
  60
+The decorators in :mod:`django.views.decorators.gzip` control content
  61
+compression on a per-view basis.
  62
+
53 63
 .. function:: gzip_page()
54 64
 
55 65
 This decorator compresses content if the browser allows gzip compression.
56 66
 It sets the ``Vary`` header accordingly, so that caches will base their
57 67
 storage on the ``Accept-Encoding`` header.
58 68
 
59  
-.. currentmodule:: django.views.decorators.vary
  69
+.. module:: django.views.decorators.vary
60 70
 
61 71
 Vary headers
62 72
 ============
63 73
 
64  
-The ``Vary`` header defines which request headers a cache mechanism should take
65  
-into account when building its cache key.
  74
+The decorators in :mod:`django.views.decorators.vary` can be used to control
  75
+caching based on specific request headers.
66 76
 
67 77
 .. function:: vary_on_cookie(func)
68 78
 
69 79
 .. function:: vary_on_headers(*headers)
70 80
 
  81
+The ``Vary`` header defines which request headers a cache mechanism should take
  82
+into account when building its cache key.
  83
+
71 84
 See :ref:`using vary headers <using-vary-headers>`.

0 notes on commit 32ac8d9

Please sign in to comment.
Something went wrong with that request. Please try again.