Initial cleanup of the codebase
Change-Id: Idbc92ea3c2d7ee4d4807d1d83ceee9a299b9a9f7
diff --git a/service/providers/__init__.py b/service/providers/__init__.py
new file mode 100644
index 0000000..497a9b3
--- /dev/null
+++ b/service/providers/__init__.py
@@ -0,0 +1,32 @@
+import logging
+
+from APIFactory import URIBuilder
+
+from types import *
+from notifications import *
+from utils import *
+
+
+__author__ = 'hanl'
+
+# instance reference for authentication provider
+# must be set before usage!
+PROVIDER = None
+
+
+def init_app(config):
+ provider_name = config.get('AUTH_PROVIDER', 'providers.CustomProvider')
+ split = provider_name.split('.')
+ # get last element, so you have the class name
+ _class = split[len(split) - 1]
+
+ provider_name = provider_name.replace("." + _class, "")
+ module = __import__(provider_name)
+ obj = getattr(module, _class, None)
+ if obj is None:
+ raise KeyError("the provider class '%s.%s' is undefined or could not be found!" % (provider_name, _class))
+ instance = obj(config)
+ logging.info("successfully loaded provider '%s.%s'" % (provider_name, _class))
+ global PROVIDER
+ PROVIDER = instance
+