From 9877360a7f81943239d852de14eebf8be7674ad5 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Thu, 6 Sep 2012 11:08:10 +0200 Subject: Move the store pool to HyperKitty --- hyperkitty/lib/__init__.py | 19 ------------------- hyperkitty/lib/archiver.py | 5 +++-- 2 files changed, 3 insertions(+), 21 deletions(-) (limited to 'hyperkitty/lib') 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 -- cgit