Commit 5e6829b7 authored by Martin Matějek's avatar Martin Matějek

Templates and plugins directory structure

parent be1ae8b0
......@@ -12,7 +12,10 @@ class Api:
if conf: # override default config
config.load_config(conf)
self.plugins = PluginStorage(config.get('settings', 'plugin_dir'))
self.plugins = PluginStorage(
config.get('settings', 'plugin_dir'),
config.get('settings', 'templates_dir'),
)
self.notifications = NotificationStorage(
config.get('settings', 'volatile_dir'),
config.get('settings', 'persistent_dir'),
......
......@@ -11,6 +11,7 @@ class Config:
self.conf.set("settings", "volatile_dir", "/tmp")
self.conf.set("settings", "persistent_dir", "/srv")
self.conf.set("settings", "plugin_dir", "plugins")
self.conf.set("settings", "templates_dir", "templates")
self.conf.set("settings", "logfile", "notifylib.log")
def load_config(self, filename):
......
......@@ -8,9 +8,10 @@ from .notificationskeleton import NotificationSkeleton
class PluginStorage:
"""Storage for plugins"""
def __init__(self, plugin_dir):
def __init__(self, plugin_dir, templates_dir):
# print("Constructing new PluginStorage")
self.plugin_dir = plugin_dir
self.templates_dir = templates_dir
self.plugins = {}
self.skeletons = {}
......@@ -65,8 +66,8 @@ class PluginStorage:
tmpl_name = notification_types[skel_name]['template']
template = templates[tmpl_name]
template_dir = os.path.join(self.plugin_dir, 'templates')
self.skeletons[skel_id] = NotificationSkeleton(name, template, actions, template_dir) # cache it
templates_dir = os.path.join(self.templates_dir, plugin_name)
self.skeletons[skel_id] = NotificationSkeleton(name, template, actions, templates_dir) # cache it
# else:
# logger.warn("No such notification type '%s' in plugin '%s'", skel_name, plugin_name)
# return what?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment