Commit 60ae6262 authored by Devaev Maxim's avatar Devaev Maxim

Refactoring

parent 79ddc21a
# -*- coding: utf-8 -*-
import os
import ConfigParser
......@@ -5,6 +7,7 @@ import const
import config
#####
ConfigDictObject = {
"service" : {
"name" : (const.DEFAULT_CONFIG_SERVICE_NAME, str, None),
......@@ -14,6 +17,7 @@ ConfigDictObject = {
}
#####
class ValidatorError(Exception) :
pass
......@@ -21,6 +25,7 @@ class ValueError(Exception) :
pass
##### Public #####
def setValue(section, option, value, validator = None, valid_values_list = None) :
global ConfigDictObject
......
# -*- coding: utf-8 -*-
MY_NAME = "settingsd"
PLUGINS_DIR = "plugins"
CONFIGS_DIR = "configs"
CONFIG_FILE_POSTFIX = ".conf"
CONFIG_SERVICE_BUS_TYPE_SYSTEM = "system"
CONFIG_SERVICE_BUS_TYPE_SESSION = "session"
CONFIG_VALID_SERVICE_BUS_TYPES_LIST = (
......@@ -11,8 +15,8 @@ CONFIG_VALID_SERVICE_BUS_TYPES_LIST = (
CONFIG_SERVICE_BUS_TYPE_SESSION
)
DEFAULT_CONFIG_SERVICE_NAME = "org.etersoft.%s" % (MY_NAME)
DEFAULT_CONFIG_SERVICE_PATH = "/org/etersoft/%s" % (MY_NAME)
DEFAULT_CONFIG_SERVICE_BUS_TYPE = CONFIG_SERVICE_BUS_TYPE_SYSTEM
def __joinItems(separator, first, *others_list) :
# -*- coding: utf-8 -*-
##### Public #####
def joinPath(first, *others_list) :
return joinItems("/", first, *others_list)
def joinMethod(first, *others_list) :
return joinItems(".", first, *others_list)
##### Private #####
def joinItems(separator, first, *others_list) :
for others_list_item in others_list :
if len(first) == 0 :
first = others_list_item
......@@ -6,9 +18,3 @@ def __joinItems(separator, first, *others_list) :
first += separator + others_list_item
return first
def joinPath(first, *others_list) :
return __joinItems("/", first, *others_list)
def joinMethod(first, *others_list) :
return __joinItems(".", first, *others_list)
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