From ec7da1aac20a01838d30e02d550c13b22414be73 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Thu, 30 Aug 2012 17:58:36 +0200 Subject: Adapt to the new Storm-based KittyStore --- hyperkitty/lib/__init__.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'hyperkitty/lib') diff --git a/hyperkitty/lib/__init__.py b/hyperkitty/lib/__init__.py index aa5a3d9..d6ad4aa 100644 --- a/hyperkitty/lib/__init__.py +++ b/hyperkitty/lib/__init__.py @@ -1,7 +1,27 @@ #-*- coding: utf-8 -*- -from hashlib import md5 import urllib +from hashlib import md5 +import threading + +from django.conf import settings + +from hyperkitty.utils import log + +import kittystore + + +class ThreadSafeStorePool(object): + + 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): -- cgit