summaryrefslogtreecommitdiffstats
path: root/hyperkitty/lib
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2012-09-06 11:08:10 +0200
committerAurélien Bompard <aurelien@bompard.org>2012-09-06 11:08:10 +0200
commit9877360a7f81943239d852de14eebf8be7674ad5 (patch)
tree835d3adec2ec9eba46233f5d7724aea9af4ceece /hyperkitty/lib
parent54f6eb7982a562a3526ee3b9be62fa6e9344dbdb (diff)
downloadhyperkitty-9877360a7f81943239d852de14eebf8be7674ad5.tar.gz
hyperkitty-9877360a7f81943239d852de14eebf8be7674ad5.tar.xz
hyperkitty-9877360a7f81943239d852de14eebf8be7674ad5.zip
Move the store pool to HyperKitty
Diffstat (limited to 'hyperkitty/lib')
-rw-r--r--hyperkitty/lib/__init__.py19
-rw-r--r--hyperkitty/lib/archiver.py5
2 files changed, 3 insertions, 21 deletions
diff --git a/hyperkitty/lib/__init__.py b/hyperkitty/lib/__init__.py
index 9b541f9..be8e27d 100644
--- a/hyperkitty/lib/__init__.py
+++ b/hyperkitty/lib/__init__.py
@@ -2,31 +2,12 @@
import urllib
from hashlib import md5
-import threading
import datetime
from django.conf import settings
from hyperkitty.utils import log
-import kittystore
-
-
-class ThreadSafeStorePool(object):
- """
- http://unpythonic.blogspot.fr/2007/11/using-storm-and-sqlite-in-multithreaded.html
- """
-
- def __init__(self):
- self._local = threading.local()
-
- def get(self):
- try:
- return self._local.store
- except AttributeError:
- self._local.store = kittystore.get_store(settings.KITTYSTORE_URL, debug=False)
- return self._local.store
-
def gravatar_url(email):
'''Return a gravatar url for an email address'''
diff --git a/hyperkitty/lib/archiver.py b/hyperkitty/lib/archiver.py
index d0af7a2..6fcd2f9 100644
--- a/hyperkitty/lib/archiver.py
+++ b/hyperkitty/lib/archiver.py
@@ -6,7 +6,8 @@ Class implementation of Mailman's IArchiver interface
from mailman.interfaces.archiver import IArchiver
from django.core.urlresolvers import reverse
-from hyperkitty.lib import ThreadSafeStorePool
+from django.conf import settings
+from kittystore import get_store
class Archiver(object):
@@ -48,6 +49,6 @@ class Archiver(object):
be calculated.
"""
if self.store is None:
- self.store = ThreadSafeStorePool().get()
+ self.store = get_store(settings.KITTYSTORE_URL)
msg.message_id_hash = self.store.add_to_list(mlist.list_name, msg)
# Update karma