[kupfer: 50/51] obj.base: Use _NonpersistentToken only if we have content to store
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer: 50/51] obj.base: Use _NonpersistentToken only if we have content to store
- Date: Sun, 10 Jan 2010 12:01:02 +0000 (UTC)
commit b2b2fec3f8817cb24e8ee6ce30f834633b56c5a5
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Jan 10 12:42:25 2010 +0100
obj.base: Use _NonpersistentToken only if we have content to store
kupfer/core/data.py | 2 +-
kupfer/obj/base.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index 7bd8a24..8a3d718 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -499,7 +499,7 @@ class SourceController (pretty.OutputMixin):
if hasattr(obj, "has_content"):
types = tuple(action.object_types()) if action else ()
contents = list(self.get_contents_for_leaf(obj, types))
- content = contents and contents[0]
+ content = contents[0] if contents else None
if len(contents) > 1:
content = sources.SourcesSource(contents, name=unicode(obj),
use_reprs=False)
diff --git a/kupfer/obj/base.py b/kupfer/obj/base.py
index d877fb2..61ca5a7 100644
--- a/kupfer/obj/base.py
+++ b/kupfer/obj/base.py
@@ -174,7 +174,7 @@ class Leaf (KupferObject):
def add_content(self, content):
"""Register content source @content with Leaf"""
- self._content_source = _NonpersistentToken(content)
+ self._content_source = content and _NonpersistentToken(content)
def has_content(self):
return self._content_source
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]