Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
60ae6262
Commit
60ae6262
authored
Sep 03, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
79ddc21a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
8 deletions
+25
-8
__init__.py
settingsd/__init__.py
+2
-0
config.py
settingsd/config.py
+5
-0
const.py
settingsd/const.py
+5
-1
tools.py
settingsd/tools.py
+13
-7
No files found.
settingsd/__init__.py
View file @
60ae6262
# -*- coding: utf-8 -*-
settingsd/config.py
View file @
60ae6262
# -*- coding: utf-8 -*-
import
os
import
os
import
ConfigParser
import
ConfigParser
...
@@ -5,6 +7,7 @@ import const
...
@@ -5,6 +7,7 @@ import const
import
config
import
config
#####
ConfigDictObject
=
{
ConfigDictObject
=
{
"service"
:
{
"service"
:
{
"name"
:
(
const
.
DEFAULT_CONFIG_SERVICE_NAME
,
str
,
None
),
"name"
:
(
const
.
DEFAULT_CONFIG_SERVICE_NAME
,
str
,
None
),
...
@@ -14,6 +17,7 @@ ConfigDictObject = {
...
@@ -14,6 +17,7 @@ ConfigDictObject = {
}
}
#####
class
ValidatorError
(
Exception
)
:
class
ValidatorError
(
Exception
)
:
pass
pass
...
@@ -21,6 +25,7 @@ class ValueError(Exception) :
...
@@ -21,6 +25,7 @@ class ValueError(Exception) :
pass
pass
##### Public #####
def
setValue
(
section
,
option
,
value
,
validator
=
None
,
valid_values_list
=
None
)
:
def
setValue
(
section
,
option
,
value
,
validator
=
None
,
valid_values_list
=
None
)
:
global
ConfigDictObject
global
ConfigDictObject
...
...
settingsd/const.py
View file @
60ae6262
# -*- coding: utf-8 -*-
MY_NAME
=
"settingsd"
MY_NAME
=
"settingsd"
PLUGINS_DIR
=
"plugins"
PLUGINS_DIR
=
"plugins"
CONFIGS_DIR
=
"configs"
CONFIGS_DIR
=
"configs"
CONFIG_FILE_POSTFIX
=
".conf"
CONFIG_FILE_POSTFIX
=
".conf"
CONFIG_SERVICE_BUS_TYPE_SYSTEM
=
"system"
CONFIG_SERVICE_BUS_TYPE_SYSTEM
=
"system"
CONFIG_SERVICE_BUS_TYPE_SESSION
=
"session"
CONFIG_SERVICE_BUS_TYPE_SESSION
=
"session"
CONFIG_VALID_SERVICE_BUS_TYPES_LIST
=
(
CONFIG_VALID_SERVICE_BUS_TYPES_LIST
=
(
...
@@ -11,8 +15,8 @@ CONFIG_VALID_SERVICE_BUS_TYPES_LIST = (
...
@@ -11,8 +15,8 @@ CONFIG_VALID_SERVICE_BUS_TYPES_LIST = (
CONFIG_SERVICE_BUS_TYPE_SESSION
CONFIG_SERVICE_BUS_TYPE_SESSION
)
)
DEFAULT_CONFIG_SERVICE_NAME
=
"org.etersoft.
%
s"
%
(
MY_NAME
)
DEFAULT_CONFIG_SERVICE_NAME
=
"org.etersoft.
%
s"
%
(
MY_NAME
)
DEFAULT_CONFIG_SERVICE_PATH
=
"/org/etersoft/
%
s"
%
(
MY_NAME
)
DEFAULT_CONFIG_SERVICE_PATH
=
"/org/etersoft/
%
s"
%
(
MY_NAME
)
DEFAULT_CONFIG_SERVICE_BUS_TYPE
=
CONFIG_SERVICE_BUS_TYPE_SYSTEM
DEFAULT_CONFIG_SERVICE_BUS_TYPE
=
CONFIG_SERVICE_BUS_TYPE_SYSTEM
settingsd/tools.py
View file @
60ae6262
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
:
for
others_list_item
in
others_list
:
if
len
(
first
)
==
0
:
if
len
(
first
)
==
0
:
first
=
others_list_item
first
=
others_list_item
...
@@ -6,9 +18,3 @@ def __joinItems(separator, first, *others_list) :
...
@@ -6,9 +18,3 @@ def __joinItems(separator, first, *others_list) :
first
+=
separator
+
others_list_item
first
+=
separator
+
others_list_item
return
first
return
first
def
joinPath
(
first
,
*
others_list
)
:
return
__joinItems
(
"/"
,
first
,
*
others_list
)
def
joinMethod
(
first
,
*
others_list
)
:
return
__joinItems
(
"."
,
first
,
*
others_list
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment