Permalink
Browse files

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 907bfa1e2efccc39b51b01fde45dce5522a6af09
Showing with 6 additions and 6 deletions.
  1. +2 −2 nikola/nikola.py
  2. +1 −1 nikola/plugins/compile/rest/doc.py
  3. +3 −3 nikola/post.py
@@ -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),
@@ -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:
@@ -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
@@ -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)
@@ -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)'))
@@ -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

0 comments on commit 907bfa1

Please sign in to comment.