Commit 02387318 authored by Devaev Maxim's avatar Devaev Maxim

New plugins type, named Customs

parent 9b0f78c4
...@@ -8,6 +8,7 @@ VERSION = "0.1" ...@@ -8,6 +8,7 @@ VERSION = "0.1"
FUNCTIONS_DIR = "functions" FUNCTIONS_DIR = "functions"
ACTIONS_DIR = "actions" ACTIONS_DIR = "actions"
CUSTOMS_DIR = "customs"
CONFIGS_DIR = "configs" CONFIGS_DIR = "configs"
CONFIG_FILE_POSTFIX = ".conf" CONFIG_FILE_POSTFIX = ".conf"
......
...@@ -40,10 +40,10 @@ class Server(object) : ...@@ -40,10 +40,10 @@ class Server(object) :
### ###
def loadModules(self) : def loadModules(self) :
sys.path.append(const.FUNCTIONS_DIR) for modules_path_list_item in (const.FUNCTIONS_DIR, const.ACTIONS_DIR, const.CUSTOMS_DIR) :
sys.path.append(const.ACTIONS_DIR) logger.debug("Processing directory \"%s\"..." % (modules_path_list_item))
sys.path.append(modules_path_list_item)
for modules_path_list_item in (const.FUNCTIONS_DIR, const.ACTIONS_DIR) :
for module_name in [ item[:-3] for item in os.listdir(modules_path_list_item) if item.endswith(".py") ] : for module_name in [ item[:-3] for item in os.listdir(modules_path_list_item) if item.endswith(".py") ] :
try : try :
self._modules_list.append(__import__(module_name, globals(), locals(), [""])) self._modules_list.append(__import__(module_name, globals(), locals(), [""]))
...@@ -59,8 +59,7 @@ class Server(object) : ...@@ -59,8 +59,7 @@ class Server(object) :
logger.verbose("Loaded module: %s" % (module_name)) logger.verbose("Loaded module: %s" % (module_name))
sys.path.remove(const.FUNCTIONS_DIR) sys.path.remove(modules_path_list_item)
sys.path.remove(const.ACTIONS_DIR)
### ###
......
...@@ -129,3 +129,14 @@ class Actions(object) : ...@@ -129,3 +129,14 @@ class Actions(object) :
@classmethod @classmethod
def name(self) : def name(self) :
return "Actions" return "Actions"
class Customs(object) :
__metaclass__ = SharedRootMeta
### Public ###
@classmethod
def name(self) :
return "Customs"
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