mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +11:00
API Formatter fixes
This commit is contained in:
parent
7b99cbab6e
commit
227e36ce35
1 changed files with 6 additions and 5 deletions
|
@ -257,12 +257,13 @@ class APIView(View):
|
||||||
)
|
)
|
||||||
s.save()
|
s.save()
|
||||||
|
|
||||||
|
# Custom formatter for the API response
|
||||||
formatter = getattr(self, '_format_{0}'.format(response_format), None)
|
formatter = getattr(self, '_format_{0}'.format(response_format), None)
|
||||||
if formatter:
|
if callable(formatter):
|
||||||
response = self._format_default(s)
|
return HttpResponse(formatter(s))
|
||||||
else:
|
|
||||||
response = formatter(s)
|
# Otherwise use the default one.
|
||||||
return HttpResponse(response)
|
return HttpResponse(self._format_default(s))
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue