diff options
| author | Tom Christie | 2012-02-17 09:19:13 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-02-17 09:19:13 +0000 |
| commit | fbf76c87affc88f04bb0d0acaecc6af6442ba921 (patch) | |
| tree | 5a75cbb061829694c4f714ae0e8413c584131739 /examples/pygments_api/views.py | |
| parent | 426493a78f3003fdba39053b6af23b93b312a777 (diff) | |
| parent | c04cb5145c4398cfac090ca7eef032296a04446f (diff) | |
| download | django-rest-framework-fbf76c87affc88f04bb0d0acaecc6af6442ba921.tar.bz2 | |
Merge git://github.com/sebpiq/django-rest-framework into develop
Diffstat (limited to 'examples/pygments_api/views.py')
| -rw-r--r-- | examples/pygments_api/views.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/pygments_api/views.py b/examples/pygments_api/views.py index ffea60ae..852b6730 100644 --- a/examples/pygments_api/views.py +++ b/examples/pygments_api/views.py @@ -61,7 +61,7 @@ class PygmentsRoot(View): Return a list of all currently existing snippets. """ unique_ids = [os.path.split(f)[1] for f in list_dir_sorted_by_ctime(HIGHLIGHTED_CODE_DIR)] - return [reverse('pygments-instance', args=[unique_id]) for unique_id in unique_ids] + return Response([reverse('pygments-instance', args=[unique_id]) for unique_id in unique_ids]) def post(self, request): """ @@ -81,7 +81,8 @@ class PygmentsRoot(View): remove_oldest_files(HIGHLIGHTED_CODE_DIR, MAX_FILES) - return Response(status.HTTP_201_CREATED, headers={'Location': reverse('pygments-instance', args=[unique_id])}) + self.headers['Location'] = reverse('pygments-instance', args=[unique_id]) + return Response(status=status.HTTP_201_CREATED) class PygmentsInstance(View): @@ -89,7 +90,7 @@ class PygmentsInstance(View): Simply return the stored highlighted HTML file with the correct mime type. This Resource only renders HTML and uses a standard HTML renderer rather than the renderers.DocumentingHTMLRenderer class. """ - renderers = (HTMLRenderer,) + renderer_classes = (HTMLRenderer,) def get(self, request, unique_id): """ @@ -98,7 +99,7 @@ class PygmentsInstance(View): pathname = os.path.join(HIGHLIGHTED_CODE_DIR, unique_id) if not os.path.exists(pathname): return Response(status.HTTP_404_NOT_FOUND) - return open(pathname, 'r').read() + return Response(open(pathname, 'r').read()) def delete(self, request, unique_id): """ @@ -107,5 +108,5 @@ class PygmentsInstance(View): pathname = os.path.join(HIGHLIGHTED_CODE_DIR, unique_id) if not os.path.exists(pathname): return Response(status.HTTP_404_NOT_FOUND) - return os.remove(pathname) + return Response(os.remove(pathname)) |
