Command init does not fail when directory does not exist
authorFrederic Massart <fred@moodle.com>
Fri, 28 Jun 2013 04:38:29 +0000 (12:38 +0800)
committerFrederic Massart <fred@moodle.com>
Fri, 28 Jun 2013 04:38:46 +0000 (12:38 +0800)
lib/command.py
lib/commands/config.py
lib/commands/init.py

index 1275e05..9c7157e 100644 (file)
@@ -46,13 +46,15 @@ class Command(object):
             )
         ]
     _description = 'Undocumented command'
+    _loadWorkplace = True
 
     __C = None
     __Wp = None
 
     def __init__(self, config):
         self.__C = config
-        self.__Wp = workplace.Workplace()
+        if self._loadWorkplace:
+            self.__Wp = workplace.Workplace()
 
     def argumentError(self, message):
         raise CommandArgumentError(message)
index 981d021..dc1a7e6 100644 (file)
@@ -86,6 +86,7 @@ class ConfigCommand(Command):
         )
     ]
     _description = 'Manage your configuration'
+    _loadWorkplace = False
 
     def run(self, args):
         if args.action == 'list':
index 44ca1e5..340b9d9 100644 (file)
@@ -45,6 +45,7 @@ class InitCommand(Command):
         )
     ]
     _description = 'Initialise MDK'
+    _loadWorkplace = False
 
     def resolve_directory(self, path, user):
         if path.startswith('~'):