Delay initializition of the MongoKeyStore until required

This commit is contained in:
Calen Pennington
2012-06-18 13:41:53 -04:00
committed by Matthew Mongeau
parent d8d22ea57b
commit 86205c21ff
3 changed files with 14 additions and 6 deletions

View File

@@ -9,4 +9,13 @@ from __future__ import absolute_import
from django.conf import settings
from .mongo import MongoKeyStore
keystore = MongoKeyStore(**settings.KEYSTORE)
_KEYSTORE = None
def keystore():
global _KEYSTORE
if _KEYSTORE is None:
_KEYSTORE = MongoKeyStore(**settings.KEYSTORE)
return _KEYSTORE