Skip to content
Permalink
Browse files
Replace try/except with hasattr (thanks @felixfontein)
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Dec 18, 2016
1 parent c79164b commit 2420964de906f0206b52c7bf233240f45f9fdb5f
Showing with 2 additions and 3 deletions.
  1. +2 −3 nikola/utils.py
@@ -1766,12 +1766,11 @@ def clone_treenode(treenode, parent=None, acceptor=lambda x: True):
node_clone.indent_levels = treenode.indent_levels
node_clone.indent_change_before = treenode.indent_change_before
node_clone.indent_change_after = treenode.indent_change_after
try:
if hasattr(node_clone, 'classification_path'):
# Copy stuff added by taxonomies_classifier plugin
node_clone.classification_path = treenode.classification_path
node_clone.classification_name = treenode.classification_name
except AttributeError:
pass

# Accept this node if there are no children (left) and acceptor fails
if not node_clone.children and not acceptor(treenode):
return None

0 comments on commit 2420964

Please sign in to comment.