Skip to content

Commit

Permalink
User "get_permalink" to get permalink. Closes #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
tribela committed May 15, 2014
1 parent 22619e6 commit 301be58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ Might be released.

- Relative directory path on WSGI app.
[`#42`__]
- Give correct permalink.
[`#43`__]

__ https://github.com/earthreader/web/issues/42
__ https://github.com/earthreader/web/issues/43


Version 0.2.0
Expand Down
15 changes: 2 additions & 13 deletions earthreader/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,20 +779,9 @@ def find_feed_and_entry(category_id, feed_id, entry_id):
feed = stage.feeds[feed_id]
except KeyError:
raise FeedNotFound('The feed is not reachable')
feed_permalink = None
for link in feed.links:
if link.relation == 'alternate'\
and link.mimetype == 'text/html':
feed_permalink = link.uri
if not feed_permalink:
feed_permalink = feed.id
feed_permalink = get_permalink(feed)
for entry in feed.entries:
entry_permalink = None
for link in entry.links:
if link.relation == 'alternate':
entry_permalink = link.uri
if not entry_permalink:
entry_permalink = entry.id
entry_permalink = get_permalink(entry)
if entry_id == get_hash(entry.id):
return feed, feed_permalink, entry, entry_permalink
raise EntryNotFound('The entry is not reachable')
Expand Down

0 comments on commit 301be58

Please sign in to comment.