diff options
| author | tom christie tom@tomchristie.com | 2011-02-19 13:12:35 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-02-19 13:12:35 +0000 |
| commit | e4fff6ea6e5422af23c324897ed1cff8f8a6e903 (patch) | |
| tree | 030c0d0a02e25ffdef43781fbc815dbce48dd16d /djangorestframework | |
| parent | 57b3a372f2122d022f9d6f43818e5fe9d318ce03 (diff) | |
| download | django-rest-framework-e4fff6ea6e5422af23c324897ed1cff8f8a6e903.tar.bz2 | |
Clean up the docs
Diffstat (limited to 'djangorestframework')
| -rw-r--r-- | djangorestframework/authenticators.py | 11 | ||||
| -rw-r--r-- | djangorestframework/emitters.py | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/djangorestframework/authenticators.py b/djangorestframework/authenticators.py index 85ba9f11..29875c64 100644 --- a/djangorestframework/authenticators.py +++ b/djangorestframework/authenticators.py @@ -1,3 +1,9 @@ +"""The :mod:`authenticators` modules provides for pluggable authentication behaviour. + +Authentication behaviour is provided by adding the mixin class :class:`AuthenticatorMixin` to a :class:`.Resource` or Django :class:`View` class. + +The set of authenticators which are use is then specified by setting the :attr:`authenticators` attribute on the class, and listing a set of authenticator classes. +""" from django.contrib.auth import authenticate from django.middleware.csrf import CsrfViewMiddleware from djangorestframework.utils import as_tuple @@ -5,11 +11,14 @@ import base64 class AuthenticatorMixin(object): + """Adds pluggable authentication behaviour.""" + + """The set of authenticators to use.""" authenticators = None def authenticate(self, request): """Attempt to authenticate the request, returning an authentication context or None. - An authentication context may be any object, although in many cases it will be a User instance.""" + An authentication context may be any object, although in many cases it will simply be a :class:`User` instance.""" # Attempt authentication against each authenticator in turn, # and return None if no authenticators succeed in authenticating the request. diff --git a/djangorestframework/emitters.py b/djangorestframework/emitters.py index 6e101e86..be1d7ef3 100644 --- a/djangorestframework/emitters.py +++ b/djangorestframework/emitters.py @@ -32,6 +32,12 @@ _MSIE_USER_AGENT = re.compile(r'^Mozilla/[0-9]+\.[0-9]+ \([^)]*; MSIE [0-9]+\.[0 class EmitterMixin(object): + """Adds behaviour for pluggable Emitters to a :class:`.Resource` or Django :class:`View`. class. + + Default behaviour is to use standard HTTP Accept header content negotiation. + Also supports overidding the content type by specifying an _accept= parameter in the URL. + Ignores Accept headers from Internet Explorer user agents and uses a sensible browser Accept header instead.""" + ACCEPT_QUERY_PARAM = '_accept' # Allow override of Accept header in URL query params REWRITE_IE_ACCEPT_HEADER = True @@ -40,6 +46,7 @@ class EmitterMixin(object): emitters = () def emit(self, response): + """Takes a :class:`Response` object and returns a Django :class:`HttpResponse`.""" self.response = response try: |
