aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/resource.py
diff options
context:
space:
mode:
authorTom Christie2011-04-11 13:45:38 +0100
committerTom Christie2011-04-11 13:45:38 +0100
commitcb9fb6ef2f9ac38c4f1c3946252a542b1f3f15d7 (patch)
treebde00f0ae3c0dbbb148d727b424da497e1f6b49f /djangorestframework/resource.py
parent941742593c50dcb0e1ca426621d107f12c9ee65c (diff)
downloaddjango-rest-framework-cb9fb6ef2f9ac38c4f1c3946252a542b1f3f15d7.tar.bz2
Refactoring of authentication/permissions
Diffstat (limited to 'djangorestframework/resource.py')
-rw-r--r--djangorestframework/resource.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/djangorestframework/resource.py b/djangorestframework/resource.py
index 6ec22073..e6290363 100644
--- a/djangorestframework/resource.py
+++ b/djangorestframework/resource.py
@@ -6,7 +6,7 @@ from djangorestframework.emitters import EmitterMixin
from djangorestframework.authenticators import AuthenticatorMixin
from djangorestframework.validators import FormValidatorMixin
from djangorestframework.response import Response, ResponseException
-from djangorestframework.request import RequestMixin
+from djangorestframework.request import RequestMixin, AuthMixin
from djangorestframework import emitters, parsers, authenticators, status
@@ -18,7 +18,7 @@ from djangorestframework import emitters, parsers, authenticators, status
__all__ = ['Resource']
-class Resource(EmitterMixin, AuthenticatorMixin, FormValidatorMixin, RequestMixin, View):
+class Resource(EmitterMixin, AuthMixin, FormValidatorMixin, RequestMixin, View):
"""Handles incoming requests and maps them to REST operations,
performing authentication, input deserialization, input validation, output serialization."""
@@ -139,7 +139,7 @@ class Resource(EmitterMixin, AuthenticatorMixin, FormValidatorMixin, RequestMixi
# Typically the context will be a user, or None if this is an anonymous request,
# but it could potentially be more complex (eg the context of a request key which
# has been signed against a particular set of permissions)
- auth_context = self.authenticate(request)
+ auth_context = self.auth
# If using a form POST with '_method'/'_content'/'_content_type' overrides, then alter
# self.method, self.content_type, self.CONTENT appropriately.
@@ -173,6 +173,10 @@ class Resource(EmitterMixin, AuthenticatorMixin, FormValidatorMixin, RequestMixi
except ResponseException, exc:
response = exc.response
+
+ except:
+ import traceback
+ traceback.print_exc()
# Always add these headers.
#