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()
|
||||
|
||||
# Custom formatter for the API response
|
||||
formatter = getattr(self, '_format_{0}'.format(response_format), None)
|
||||
if formatter:
|
||||
response = self._format_default(s)
|
||||
else:
|
||||
response = formatter(s)
|
||||
return HttpResponse(response)
|
||||
if callable(formatter):
|
||||
return HttpResponse(formatter(s))
|
||||
|
||||
# Otherwise use the default one.
|
||||
return HttpResponse(self._format_default(s))
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue