Allow usage of external IdentDB instance

Server can be configured to use external IdentDB instance
The configuration has to be a tuple with following syntax:
('identdb', 'module.class')

This allows to use custom databases by creating a derived class from IdentDB
This commit is contained in:
tpazderka
2014-06-26 17:29:39 +02:00
parent 041aa27dcd
commit 563ce9068b

View File

@@ -21,6 +21,7 @@ or attribute authority (AA) may use to conclude its tasks.
import logging
import os
import importlib
import shelve
import threading
@@ -144,7 +145,12 @@ class Server(Entity):
self.ident = IdentMDB(database=addr, collection="ident")
if typ == "mongodb":
elif typ == "identdb":
mod, clas = addr.rsplit('.', 1)
mod = importlib.import_module(mod)
self.ident = getattr(mod, clas)()
if typ == "mongodb" or typ == "identdb":
pass
elif idb is not None:
self.ident = IdentDB(idb)