More fixes

This commit is contained in:
root 2011-05-30 08:55:48 +00:00
parent edf59865d6
commit e71fdca4fd
3 changed files with 4 additions and 6 deletions

View file

@ -5,14 +5,10 @@ from piston.handler import AnonymousBaseHandler
from pastebin.apps.dpaste.models import Snippet from pastebin.apps.dpaste.models import Snippet
class SnippetHandler(AnonymousBaseHandler): class SnippetHandler(AnonymousBaseHandler):
allowed_methods = ('GET', 'POST') allowed_methods = ('POST',)
fields = ('title', 'content',) fields = ('title', 'content',)
model = Snippet model = Snippet
def read(self, request, secret_id):
post = Snippet.objects.get(secret_id=secret_id)
return post
def create(self, request): def create(self, request):
if not request.POST.get('content'): if not request.POST.get('content'):
return rc.BAD_REQUEST return rc.BAD_REQUEST

View file

@ -99,7 +99,6 @@ INSTALLED_APPS = (
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'mptt', 'mptt',
'piston',
'pastebin', 'pastebin',
'pastebin.apps.dpaste', 'pastebin.apps.dpaste',
'gunicorn', 'gunicorn',

3
pastebin/disable.py Normal file
View file

@ -0,0 +1,3 @@
class DisableCSRF(object):
def process_request(self, request):
setattr(request, '_dont_enforce_csrf_checks', True)