Skip to content

Commit

Permalink
Fixed bug where for some pages creating multiple feeds of that archiv…
Browse files Browse the repository at this point in the history
…e would cause uniqueness constraint violations
  • Loading branch information
malnoxon committed Aug 22, 2016
1 parent 1793955 commit f6e46cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rsstory/feed_management.pt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<li class="menu" tal:condition="not: logged_in" style="float:right"><a href="login">Login</a></li>
<li class="menu" tal:condition="logged_in" style="float:right"><a href="${request.application_url}/logout">Logout</a></li>
<li class="menu" tal:condition="user_email" style="float:right"><a href="${request.application_url}/my-feeds">${user_email}</a></li>
<li class="menu" class="active" tal:condition="logged_in" style="float:right"><a href="my-feeds">My Feeds</a></li>
<li class="menu" tal:condition="logged_in" style="float:right"><a class="active" href="my-feeds">My Feeds</a></li>
</ul>

<head>
Expand Down
2 changes: 1 addition & 1 deletion rsstory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Page(Base):
archive_url = Column(Text, primary_key=True)
id = Column(Integer, primary_key=True)
name = Column(Text)
page_url = Column(Text, nullable=False)
page_url = Column(Text, nullable=False) # TODO: make unique?
description = Column(Text)
time_created = Column(Text, nullable=False)

Expand Down
2 changes: 1 addition & 1 deletion rsstory/rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def gen_pages(items, data_list, time_between, archive_url):
index = 0
while data_list:
data = data_list.pop(0)
page = DBSession.query(Page).filter_by(id=index, name=data[1], page_url=data[0], archive_url=archive_url).first()
page = DBSession.query(Page).filter_by(id=index, archive_url=archive_url).first()
if not page:
page = Page(id=index, name=data[1], page_url=data[0], archive_url=archive_url, time_created=int(time.time()))
DBSession.add(page)
Expand Down

0 comments on commit f6e46cc

Please sign in to comment.