From a7852c804207cd47a00d43edad24006f937a308c Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Fri, 30 Sep 2011 22:05:42 -0400 Subject: [PATCH] Removing piston API --- .hgignore | 1 + .venv | 2 +- api/__init__.py | 0 api/handlers.py | 31 ------------------------------- api/urls.py | 17 ----------------- requirements.txt | 2 +- 6 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 api/__init__.py delete mode 100644 api/handlers.py delete mode 100644 api/urls.py diff --git a/.hgignore b/.hgignore index 01e07fe..d246838 100644 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,7 @@ syntax: glob *.json +*.log *.gunicorn.* *.pyc *.sql diff --git a/.venv b/.venv index f5439f9..f204d21 100644 --- a/.venv +++ b/.venv @@ -1 +1 @@ -beta-snipt +snipt diff --git a/api/__init__.py b/api/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/api/handlers.py b/api/handlers.py deleted file mode 100644 index 2c59d2d..0000000 --- a/api/handlers.py +++ /dev/null @@ -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 diff --git a/api/urls.py b/api/urls.py deleted file mode 100644 index b215780..0000000 --- a/api/urls.py +++ /dev/null @@ -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\d+)/', snipt_handler), -) diff --git a/requirements.txt b/requirements.txt index 9fb7907..9c7d573 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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