Bits of cleanup

This commit is contained in:
Tom Christie 2011-05-10 12:59:13 +01:00
parent cc4c9a9518
commit a2575c1191
2 changed files with 10 additions and 5 deletions

View File

@ -150,7 +150,9 @@ class RequestMixin(object):
return self._content
# TODO: Modify this so that it happens implictly, rather than being called explicitly
# ie accessing any of .DATA, .FILES, .content_type, .stream or .method will force
# form overloading.
def perform_form_overloading(self):
"""
Check the request to see if it is using form POST '_method'/'_content'/'_content_type' overrides.
@ -199,6 +201,7 @@ class RequestMixin(object):
content_type})
# TODO: Acutally this needs to go into Resource
def validate(self, content):
"""
Validate, cleanup, and type-ify the request content.
@ -209,6 +212,7 @@ class RequestMixin(object):
return content
# TODO: Acutally this needs to go into Resource
def get_bound_form(self, content=None):
"""
Return a bound form instance for the given content,
@ -229,7 +233,7 @@ class RequestMixin(object):
@property
def default_parser(self):
"""Return the view's most preferred renderer.
"""Return the view's most preferred parser.
(This has no behavioral effect, but is may be used by documenting renderers)"""
return self.parsers[0]
@ -256,8 +260,8 @@ class ResponseMixin(object):
renderers = ()
# TODO: wrap this behavior around dispatch(), ensuring it works well with
# existing Django classes that use render_to_response.
# TODO: wrap this behavior around dispatch(), ensuring it works
# out of the box with existing Django classes that use render_to_response.
def render(self, response):
"""
Takes a ``Response`` object and returns an ``HttpResponse``.

View File

@ -6,6 +6,7 @@ import decimal
import inspect
import re
# TODO: Replace this with new Serializer code based on Forms API.
class Resource(object):
"""A Resource determines how an object maps to a serializable entity.
@ -61,7 +62,7 @@ class Resource(object):
if inspect.ismethod(f) and len(inspect.getargspec(f)[0]) == 1:
ret = _any(f())
else:
ret = unicode(thing) # TRC TODO: Change this back!
ret = unicode(thing) # TRC
return ret