[kupfer] data: Delegate error checking in action execution to commandexec



commit 5a40d58520b49359fe8df4169cdbf8cfcc77e190
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Jan 9 03:04:18 2010 +0100

    data: Delegate error checking in action execution to commandexec

 kupfer/core/data.py |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index 1049e2b..1775b45 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -1039,14 +1039,12 @@ class DataController (gobject.GObject, pretty.OutputMixin):
 		leaf = self.source_pane.get_selection()
 		sobject = self.object_pane.get_selection()
 		mode = self.mode
-		if not action or not leaf:
-			self.output_info("There is no selection!")
-			return
-		if not sobject and self.mode is SourceActionObjectMode:
-			self.output_info("There is no third object!")
+		try:
+			ctx = self._execution_context
+			res, ret = ctx.run(leaf, action, sobject)
+		except commandexec.ActionExecutionError, exc:
+			self.output_error(exc)
 			return
-		ctx = self._execution_context
-		res, ret = ctx.run(leaf, action, sobject)
 
 		# register search to learning database
 		learn.record_search_hit(leaf, self.source_pane.get_latest_key())



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]