[kupfer] twitter: Friend: contact group takes precedence over timeline as content



commit 199c23c5c7d91060fcb728cacef489fc00a97dbc
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Mar 9 00:02:43 2010 +0100

    twitter: Friend: contact group takes precedence over timeline as content
    
    Since the Friend class is a ContactLeaf, and the friend source is a
    Grouping Source, it may be in the situation where it is grouped
    together with other contacts, and the twitter Friend is the "main"
    contant.
    
    In this case, we must delegate to the superclass' implementation of
    has_content and content_source. In this case, you can access the
    timeline by first entering the Twitter contact, then its "real" entry
    inside itself. It doesn't sound too logical, but I think it will work.

 kupfer/plugin/twitter/__init__.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/twitter/__init__.py b/kupfer/plugin/twitter/__init__.py
index 6d7cfa2..baa6954 100644
--- a/kupfer/plugin/twitter/__init__.py
+++ b/kupfer/plugin/twitter/__init__.py
@@ -173,10 +173,13 @@ class Friend(ContactLeaf):
 		return self.object[TWITTER_USERNAME_KEY]
 
 	def has_content(self):
-		return bool(self.tweets)
+		return bool(self.tweets) or ContactLeaf.has_content(self)
 
 	def content_source(self, alternate=False):
-		return FriendStatusesSource(self)
+		if ContactLeaf.has_content(self):
+			return ContactLeaf.content_source(self, alternate=alternate)
+		if self.tweets:
+			return FriendStatusesSource(self)
 
 	def get_description(self):
 		return self[TWITTER_USERNAME_KEY]



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