--- a/degal/command.py Thu Jun 11 21:40:12 2009 +0300
+++ b/degal/command.py Thu Jun 11 21:40:39 2009 +0300
@@ -67,12 +67,27 @@
self.config = config
self.gallery = gallery
- def __call__ (self, *args, **kwargs) :
+ def execute (self, *args, **kwargs) :
"""
Run the command in this context
"""
return self.command.func(self, *args, **kwargs)
+
+ def run (self, *args, **kwargs) :
+ """
+ Run the command with error handling
+ """
+
+ try :
+ # run it
+ return self.execute(*args, **kwargs)
+
+ except KeyboardInterrupt :
+ self.log_error("Interrupted")
+
+ except :
+ command_ctx.handle_error()
def log_msg (self, level, msg, *args, **kwargs) :
"""
--- a/degal/main.py Thu Jun 11 21:40:12 2009 +0300
+++ b/degal/main.py Thu Jun 11 21:40:39 2009 +0300
@@ -71,13 +71,9 @@
# setup the command execution context
command_ctx = command.setup(config, gallery)
-
- try :
- # run it
- return command_ctx(*args, **kwargs)
-
- except :
- command_ctx.handle_error()
+
+ # run with error handling
+ return command_ctx.run()
def main (argv) :
"""