Browse Source

Move Subcommand instantiation to run

To prevent duplication of error catching
Alois Mahdal 10 years ago
parent
commit
c68008d4cf
1 changed files with 2 additions and 4 deletions
  1. 2
    4
      include/sardine.py

+ 2
- 4
include/sardine.py View File

99
 class App:
99
 class App:
100
 
100
 
101
     def __init__(self, cmdargs):
101
     def __init__(self, cmdargs):
102
+        self.cmdargs = cmdargs
102
         self._set_pluginpath()
103
         self._set_pluginpath()
103
-        try:
104
-            self.subcommand = Subcommand(cmdargs, self.pluginpath)
105
-        except SardinePluginError as e:
106
-            self.die(e)
107
 
104
 
108
     def _set_pluginpath(self):
105
     def _set_pluginpath(self):
109
         mypath = os.path.dirname(os.path.realpath(sys.argv[0]))
106
         mypath = os.path.dirname(os.path.realpath(sys.argv[0]))
120
 
117
 
121
     def run(self):
118
     def run(self):
122
         try:
119
         try:
120
+            self.subcommand = Subcommand(self.cmdargs, self.pluginpath)
123
             print self.subcommand.get_output()
121
             print self.subcommand.get_output()
124
         except SardinePluginError as e:
122
         except SardinePluginError as e:
125
             self.die(e, 10)
123
             self.die(e, 10)