projects
/
mdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
10c0708
)
Config object is a singleton
author
Frederic Massart
<fred@moodle.com>
Wed, 20 Feb 2013 08:20:34 +0000
(16:20 +0800)
committer
Fred
<fmcell@gmail.com>
Fri, 1 Mar 2013 11:31:32 +0000
(19:31 +0800)
lib/config.py
patch
|
blob
|
history
diff --git
a/lib/config.py
b/lib/config.py
index
4b4198b
..
1405d42
100644
(file)
--- a/
lib/config.py
+++ b/
lib/config.py
@@
-215,6
+215,12
@@
class Conf(Config):
"""MDK config class"""
userFile = None
+ _instance = None
+
+ def __new__(cls, *args, **kwargs):
+ if not cls._instance:
+ cls._instance = super(Conf, cls).__new__(cls, *args, **kwargs)
+ return cls._instance
def __init__(self, userfile=None):
if userfile == None: