Merge branch 'master' of github.com:FMCorz/mdk
authorFrederic Massart <fred@moodle.com>
Thu, 21 Feb 2013 00:42:18 +0000 (08:42 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 21 Feb 2013 00:42:18 +0000 (08:42 +0800)
1  2 
lib/config.py

diff --cc lib/config.py
@@@ -225,15 -215,11 +215,17 @@@ 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):
-         self.userFile = os.path.expanduser('~/.moodle-sdk/config.json')
+     def __init__(self, userfile=None):
+         if userfile == None:
+             userfile = os.path.expanduser('~/.moodle-sdk/config.json')
+         self.userFile = userfile
          files = [
              os.path.join(os.path.dirname(__file__), '..', 'config-dist.json'),
              os.path.join(os.path.dirname(__file__), '..', 'config.json'),