aboutsummaryrefslogtreecommitdiffstats
path: root/flywheel/emitters.py
diff options
context:
space:
mode:
authorTom Christie2011-01-28 17:42:57 +0000
committerTom Christie2011-01-28 17:42:57 +0000
commit40f47a9fb31aebd965dce03ae57c036d5360d124 (patch)
tree9e95ee3e500b5c2d8eb4e1adecefaf1d2de47b8a /flywheel/emitters.py
parent2e9fd9c6b93a77dcf5caa42a4d71b9da2021693f (diff)
downloaddjango-rest-framework-40f47a9fb31aebd965dce03ae57c036d5360d124.tar.bz2
Minor bit of tidy up (all the stuff I noticed when demoing to francis)
Diffstat (limited to 'flywheel/emitters.py')
-rw-r--r--flywheel/emitters.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/flywheel/emitters.py b/flywheel/emitters.py
index d052d965..57e95ec2 100644
--- a/flywheel/emitters.py
+++ b/flywheel/emitters.py
@@ -32,6 +32,8 @@ class BaseEmitter(object):
self.resource = resource
def emit(self, output=NoContent, verbose=False):
+ """By default emit simply returns the ouput as-is.
+ Override this method to provide for other behaviour."""
if output is NoContent:
return ''
@@ -81,7 +83,8 @@ class DocumentingTemplateEmitter(BaseEmitter):
provide a form that can be used to submit arbitrary content."""
# Get the form instance if we have one bound to the input
form_instance = resource.form_instance
-
+ print form_instance
+
# Otherwise if this isn't an error response
# then attempt to get a form bound to the response object
if not form_instance and resource.response.has_content_body:
@@ -89,6 +92,8 @@ class DocumentingTemplateEmitter(BaseEmitter):
form_instance = resource.get_form(resource.response.raw_content)
except:
pass
+ if form_instance and not form_instance.is_valid():
+ form_instance = None
# If we still don't have a form instance then try to get an unbound form
if not form_instance: