Commit a2575c11 by Tom Christie

Bits of cleanup

parent cc4c9a95
...@@ -150,7 +150,9 @@ class RequestMixin(object): ...@@ -150,7 +150,9 @@ class RequestMixin(object):
return self._content 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): def perform_form_overloading(self):
""" """
Check the request to see if it is using form POST '_method'/'_content'/'_content_type' overrides. Check the request to see if it is using form POST '_method'/'_content'/'_content_type' overrides.
...@@ -199,6 +201,7 @@ class RequestMixin(object): ...@@ -199,6 +201,7 @@ class RequestMixin(object):
content_type}) content_type})
# TODO: Acutally this needs to go into Resource
def validate(self, content): def validate(self, content):
""" """
Validate, cleanup, and type-ify the request content. Validate, cleanup, and type-ify the request content.
...@@ -209,6 +212,7 @@ class RequestMixin(object): ...@@ -209,6 +212,7 @@ class RequestMixin(object):
return content return content
# TODO: Acutally this needs to go into Resource
def get_bound_form(self, content=None): def get_bound_form(self, content=None):
""" """
Return a bound form instance for the given content, Return a bound form instance for the given content,
...@@ -229,7 +233,7 @@ class RequestMixin(object): ...@@ -229,7 +233,7 @@ class RequestMixin(object):
@property @property
def default_parser(self): 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)""" (This has no behavioral effect, but is may be used by documenting renderers)"""
return self.parsers[0] return self.parsers[0]
...@@ -256,8 +260,8 @@ class ResponseMixin(object): ...@@ -256,8 +260,8 @@ class ResponseMixin(object):
renderers = () renderers = ()
# TODO: wrap this behavior around dispatch(), ensuring it works well with # TODO: wrap this behavior around dispatch(), ensuring it works
# existing Django classes that use render_to_response. # out of the box with existing Django classes that use render_to_response.
def render(self, response): def render(self, response):
""" """
Takes a ``Response`` object and returns an ``HttpResponse``. Takes a ``Response`` object and returns an ``HttpResponse``.
......
...@@ -6,6 +6,7 @@ import decimal ...@@ -6,6 +6,7 @@ import decimal
import inspect import inspect
import re import re
# TODO: Replace this with new Serializer code based on Forms API.
class Resource(object): class Resource(object):
"""A Resource determines how an object maps to a serializable entity. """A Resource determines how an object maps to a serializable entity.
...@@ -61,7 +62,7 @@ class Resource(object): ...@@ -61,7 +62,7 @@ class Resource(object):
if inspect.ismethod(f) and len(inspect.getargspec(f)[0]) == 1: if inspect.ismethod(f) and len(inspect.getargspec(f)[0]) == 1:
ret = _any(f()) ret = _any(f())
else: else:
ret = unicode(thing) # TRC TODO: Change this back! ret = unicode(thing) # TRC
return ret return ret
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment