Initial cleanup of the codebase

Change-Id: Idbc92ea3c2d7ee4d4807d1d83ceee9a299b9a9f7
diff --git a/service/providers/notifications.py b/service/providers/notifications.py
new file mode 100644
index 0000000..925eaba
--- /dev/null
+++ b/service/providers/notifications.py
@@ -0,0 +1,91 @@
+import os
+
+__author__ = 'hanl'
+
+path = os.path.dirname(__file__)
+# modify this to change the Template Directory
+TEMPLATE_DIR = '/templates/'
+
+
+class Handler(object):
+    def register(self, key, value):
+        setattr(self, key, value)
+
+
+    def get(self, key):
+        if hasattr(self, key):
+            return getattr(self, key)
+
+
+
+# for possible email usage
+class MessageTemplate(object):
+    def __init__(self, template_name=None, html=True, values={}):
+        self.values = values
+        self.template_name = template_name
+        self.html = html
+
+    def render(self):
+        content = open(os.path.join(path, TEMPLATE_DIR, self.template_name)).read()
+        for k, v in self.values.iteritems():
+            content = content.replace('%%s%%' % k, v)
+        return content
+
+
+class HtmlBuilder(object):
+    def __init__(self):
+        self.title = None
+        self.head = None
+        self.body = None
+
+    def appendHead(self, head):
+        if not self.head:
+            self.head = ""
+        self.head.append("\n" + head)
+
+    def appendBody(self, body):
+        if not self.body:
+            self.body = ""
+        self.head.append("\n" + body)
+
+
+
+
+class NotificationHandler(object):
+
+    @staticmethod
+    def isError(response):
+        try:
+            raw_json = response.json()
+            if raw_json.get('errors') or raw_json.get('error') or raw_json.get('err'):
+                return True
+        except ValueError:
+            if response.status_code != 200:
+                return True
+        return False
+
+    @staticmethod
+    def getMessage(response):
+        pass
+
+    @staticmethod
+    def notify(json, notify_func, **kwargs):
+        if "category" not in kwargs.keys():
+            kwargs['category'] = "danger"
+
+        if json.get('errors'):
+            for error in json.get("errors"):
+                notify_func(error[1], "danger")
+        elif json.get('error'):
+            if json.get('error_description'):
+                notify_func(json.get('error_description'), **kwargs)
+            else:
+                notify_func(json.get('error'), **kwargs)
+        elif json.get('err'):
+            notify_func(json.get('errstr'), **kwargs)
+
+    @staticmethod
+    def getLocalized(code):
+        # return _("status_" + str(code))
+        return "this is a default message"
+