Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix bad raise(e) exception handling
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 21, 2017
1 parent 26af25c commit 907bfa1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nikola/nikola.py
Expand Up @@ -1776,7 +1776,7 @@ def generic_rss_feed(self, lang, title, link, description, timeline,
if str(e) == "Document is empty":
data = ""
else: # let other errors raise
raise(e)
raise
args = {
'title': post.title(lang),
'link': post.permalink(lang, absolute=True, query=feed_append_query),
Expand Down Expand Up @@ -2448,7 +2448,7 @@ def atom_post_text(post, text):
if str(e) == "Document is empty":
text = ""
else: # let other errors raise
raise(e)
raise
return text.strip()

for post in posts:
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/compile/rest/doc.py
Expand Up @@ -64,7 +64,7 @@ def _doc_link(rawtext, text, options={}, content=[]):

try:
if post is None:
raise ValueError
raise ValueError("No post with matching slug found.")
except ValueError:
return False, False, None, None, slug

Expand Down
6 changes: 3 additions & 3 deletions nikola/post.py
Expand Up @@ -670,7 +670,7 @@ def text(self, lang=None, teaser_only=False, strip_html=False, show_read_more_li
if str(e) == "Document is empty":
return ""
# let other errors raise
raise(e)
raise
base_url = self.permalink(lang=lang)
document.make_links_absolute(base_url)

Expand Down Expand Up @@ -768,7 +768,7 @@ def paragraph_count(self):
if str(e) == "Document is empty":
return ""
# let other errors raise
raise(e)
raise

# output is a float, for no real reason at all
self._paragraph_count = int(document.xpath('count(//p)'))
Expand All @@ -786,7 +786,7 @@ def remaining_paragraph_count(self):
if str(e) == "Document is empty":
return ""
# let other errors raise
raise(e)
raise

self._remaining_paragraph_count = self.paragraph_count - int(document.xpath('count(//p)'))
return self._remaining_paragraph_count
Expand Down

0 comments on commit 907bfa1

Please sign in to comment.