Skip to content

Commit

Permalink
Refs #76 - only print 'You should restart:' if we actually have somet…
Browse files Browse the repository at this point in the history
…hing to print
  • Loading branch information
sean797 committed Mar 22, 2017
1 parent c9332c8 commit daa7232
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions tracer/views/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def next(self, index):
return True
return False

def has_content(self):
"""Return True if at least one block's content is not empty"""
return self.next(-1)
def has_content_and_title(self):
"""Return True if at least one block's content & title is not empty"""
for block in self.args.blocks[0:]:
if block["content"] and "title" in block.keys():
if block["title"]:
return True
return False
2 changes: 1 addition & 1 deletion tracer/views/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ def note_content():

view = BlocksView(self.out)
view.assign("blocks", blocks)
if view.has_content():
if view.has_content_and_title():
self.print(_("You should restart:"))
view.render()

0 comments on commit daa7232

Please sign in to comment.