Skip to content

Commit

Permalink
Fix bug: feed_id as None
Browse files Browse the repository at this point in the history
  • Loading branch information
tribela committed Oct 15, 2014
1 parent 8e23f39 commit 6b5c1fa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion libearth/subscribe.py
Expand Up @@ -321,7 +321,7 @@ class Outline(Element):
feed_uri = Attribute('xmlUrl')
alternate_uri = Attribute('htmlUrl')
children = Child('outline', 'Outline', multiple=True)
feed_id = Attribute('id', xmlns=METADATA_XMLNS)
_feed_id = Attribute('id', xmlns=METADATA_XMLNS)

_title = Attribute('title')
_category = Attribute('category', CommaSeparatedList)
Expand All @@ -336,6 +336,18 @@ def deleted(self):
"""
return bool(self.deleted_at and self.deleted_at > self.created_at)

@property
def feed_id(self):
if self.feed_uri and not self._feed_id:
self._feed_id = hashlib.sha1(
self.feed_uri.encode('utf-8')).hexdigest()

return self._feed_id

@feed_id.setter
def feed_id(self, value):
self._feed_id = value

def __eq__(self, other):
if isinstance(other, Outline):
if self.type == 'rss':
Expand Down

0 comments on commit 6b5c1fa

Please sign in to comment.