From e71fdca4fd56688e32752804bbf530e48badba73 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 30 May 2011 08:55:48 +0000 Subject: [PATCH] More fixes --- pastebin/apps/api/handlers.py | 6 +----- pastebin/conf/settings.py | 1 - pastebin/disable.py | 3 +++ 3 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 pastebin/disable.py diff --git a/pastebin/apps/api/handlers.py b/pastebin/apps/api/handlers.py index 13b0902..882101c 100644 --- a/pastebin/apps/api/handlers.py +++ b/pastebin/apps/api/handlers.py @@ -5,14 +5,10 @@ from piston.handler import AnonymousBaseHandler from pastebin.apps.dpaste.models import Snippet class SnippetHandler(AnonymousBaseHandler): - allowed_methods = ('GET', 'POST') + allowed_methods = ('POST',) fields = ('title', 'content',) model = Snippet - def read(self, request, secret_id): - post = Snippet.objects.get(secret_id=secret_id) - return post - def create(self, request): if not request.POST.get('content'): return rc.BAD_REQUEST diff --git a/pastebin/conf/settings.py b/pastebin/conf/settings.py index 17f135b..dedbd6f 100644 --- a/pastebin/conf/settings.py +++ b/pastebin/conf/settings.py @@ -99,7 +99,6 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.staticfiles', 'mptt', - 'piston', 'pastebin', 'pastebin.apps.dpaste', 'gunicorn', diff --git a/pastebin/disable.py b/pastebin/disable.py new file mode 100644 index 0000000..5e0795a --- /dev/null +++ b/pastebin/disable.py @@ -0,0 +1,3 @@ +class DisableCSRF(object): + def process_request(self, request): + setattr(request, '_dont_enforce_csrf_checks', True)