[kupfer] data: Check that returned Action results are valid
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] data: Check that returned Action results are valid
- Date: Wed, 9 Sep 2009 19:17:15 +0000 (UTC)
commit d1447e3a71148df2606ca690de407abdea9b23c1
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Sep 9 19:32:20 2009 +0200
data: Check that returned Action results are valid
We use is_valid check
kupfer/data.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/data.py b/kupfer/data.py
index 485e747..800c46a 100644
--- a/kupfer/data.py
+++ b/kupfer/data.py
@@ -975,11 +975,14 @@ class DataController (gobject.GObject, pretty.OutputMixin):
if sobject:
learn.record_search_hit(sobject, self.object_pane.get_latest_key())
+ def valid_result(obj):
+ return obj and (not hasattr(obj, "is_valid") or obj.is_valid())
+
# handle actions returning "new contexts"
- if action.is_factory() and ret:
+ if action.is_factory() and valid_result(ret):
self.source_pane.push_source(ret)
return
- if action.has_result() and ret:
+ if action.has_result() and valid_result(ret):
self.emit("pane-reset", SourcePane, search.wrap_rankable(ret))
return
elif action.is_async():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]