Removing piston API

master
Nick Sergeant 2011-09-30 22:05:42 -04:00
parent 93eb6019b6
commit a7852c8042
6 changed files with 3 additions and 50 deletions

View File

@ -1,6 +1,7 @@
syntax: glob
*.json
*.log
*.gunicorn.*
*.pyc
*.sql

2
.venv
View File

@ -1 +1 @@
beta-snipt
snipt

View File

View File

@ -1,31 +0,0 @@
from piston.handler import AnonymousBaseHandler, BaseHandler
from piston.utils import rc
from snipts.models import Snipt
class AnonSniptHandler(AnonymousBaseHandler):
model = Snipt
fields = ('title',)
def read(self, request, snipt_id):
return super(self.read)
class SniptHandler(BaseHandler):
allowed_methods = ('GET',)
anonymous = AnonSniptHandler
exclude = ('id',)
model = Snipt
def read(self, request, snipt_id):
"""
Returns an individual public or private snipt.
"""
if snipt_id:
try:
return Snipt.objects.get(pk=snipt_id, public=True)
except Snipt.DoesNotExist:
return rc.NOT_FOUND
else:
return rc.BAD_REQUEST

View File

@ -1,17 +0,0 @@
from django.conf.urls.defaults import *
from piston.emitters import Emitter
from piston.resource import Resource
from api.handlers import SniptHandler
Emitter.unregister('django')
Emitter.unregister('pickle')
Emitter.unregister('yaml')
snipt_handler = Resource(SniptHandler)
urlpatterns = patterns('',
url(r'^snipt/(?P<snipt_id>\d+)/', snipt_handler),
)

View File

@ -14,7 +14,7 @@
-e hg+ssh://hg@bitbucket.org/nicksergeant/dwfab#egg=dwfab
# API
-e hg+ssh://hg@bitbucket.org/jespern/django-piston#egg=django-piston
-e git://github.com/toastdriven/django-tastypie.git#egg=django-tastypie
BeautifulSoup
django-taggit