# Some reserved parameters to allow us to use standard HTML forms with our resource
# Some reserved parameters to allow us to use standard HTML forms with our resource
# Override any/all of these with None to disable them, or override them with another value to rename them.
# Override any/all of these with None to disable them, or override them with another value to rename them.
ACCEPT_QUERY_PARAM='_accept'# Allow override of Accept header in URL query params
ACCEPT_QUERY_PARAM='_accept'# Allow override of Accept header in URL query params CONTENTTYPE_PARAM = '_contenttype' # Allow override of Content-Type header in form params (allows sending arbitrary content with standard forms)
METHOD_PARAM='_method'# Allow POST overloading in form params
CONTENTTYPE_PARAM='_contenttype'# Allow override of Content-Type header in form params (allows sending arbitrary content with standard forms)
CONTENT_PARAM='_content'# Allow override of body content in form params (allows sending arbitrary content with standard forms)
CSRF_PARAM='csrfmiddlewaretoken'# Django's CSRF token used in form params
CSRF_PARAM='csrfmiddlewaretoken'# Django's CSRF token used in form params
_MUNGE_IE_ACCEPT_HEADER=True
_MUNGE_IE_ACCEPT_HEADER=True
...
@@ -112,18 +113,6 @@ class Resource(object):
...
@@ -112,18 +113,6 @@ class Resource(object):
(This emitter is used if the client does not send and Accept: header, or sends Accept: */*)"""
(This emitter is used if the client does not send and Accept: header, or sends Accept: */*)"""
returnself.emitters[0]
returnself.emitters[0]
@property
defparsed_media_types(self):
"""Return an list of all the media types that this resource can emit."""
return[parser.media_typeforparserinself.parsers]
@property
defdefault_parser(self):
"""Return the resource's most prefered emitter.
(This has no behavioural effect, but is may be used by documenting emitters)"""
returnself.parsers[0]
defget(self,request,auth,*args,**kwargs):
defget(self,request,auth,*args,**kwargs):
"""Must be subclassed to be implemented."""
"""Must be subclassed to be implemented."""
self.not_implemented('GET')
self.not_implemented('GET')
...
@@ -171,17 +160,6 @@ class Resource(object):
...
@@ -171,17 +160,6 @@ class Resource(object):
pass
pass
returnself.request.build_absolute_uri(path)
returnself.request.build_absolute_uri(path)
defdetermine_method(self,request):
"""Determine the HTTP method that this request should be treated as.
Allows PUT and DELETE tunneling via the _method parameter if METHOD_PARAM is set."""