summaryrefslogtreecommitdiffstats
path: root/api.py
diff options
context:
space:
mode:
authorPierre-Yves Chibon <pingou@pingoured.fr>2012-05-14 21:32:47 +0200
committerPierre-Yves Chibon <pingou@pingoured.fr>2012-05-14 21:32:47 +0200
commitb2c8b59a1f47b74604301cc547ebead4d58fd6de (patch)
treeb62217552cb44c24eaf4698693990c80f0f6a925 /api.py
parentef56c212f73356ae064861d6fab7e7be0da19cd7 (diff)
downloadhyperkitty-b2c8b59a1f47b74604301cc547ebead4d58fd6de.tar.gz
hyperkitty-b2c8b59a1f47b74604301cc547ebead4d58fd6de.tar.xz
hyperkitty-b2c8b59a1f47b74604301cc547ebead4d58fd6de.zip
Start implementing the relational database system branch
Diffstat (limited to 'api.py')
-rw-r--r--api.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/api.py b/api.py
index dbfa4b9..73b7ffa 100644
--- a/api.py
+++ b/api.py
@@ -2,11 +2,15 @@
from djangorestframework.views import View
from django.conf.urls.defaults import url
+from django.conf import settings
from django.http import HttpResponseNotModified, HttpResponse
-from lib import mongo
+from kittystore.kittysastore import KittySAStore
import json
import re
+STORE = KittySAStore(settings.KITTYSTORE_URL)
+
+
class EmailResource(View):
""" Resource used to retrieve emails from the archives using the
REST API.
@@ -14,7 +18,7 @@ class EmailResource(View):
def get(self, request, mlist_fqdn, messageid):
list_name = mlist_fqdn.split('@')[0]
- email = mongo.get_email(list_name, messageid)
+ email = STORE.get_email(list_name, messageid)
if not email:
return HttpResponse(status=404)
else:
@@ -28,7 +32,7 @@ class ThreadResource(View):
def get(self, request, mlist_fqdn, threadid):
list_name = mlist_fqdn.split('@')[0]
- thread = mongo.get_thread_list(list_name, threadid)
+ thread = STORE.get_thread(list_name, threadid)
if not thread:
return HttpResponse(status=404)
else:
@@ -56,7 +60,7 @@ class SearchResource(View):
re.compile(regex, re.IGNORECASE)}
print query_string, field, keyword
- threads = mongo.search_archives(list_name, query_string)
+ threads = STORE.search_archives(list_name, query_string)
if not threads:
return HttpResponse(status=404)
else: