From 9200e1e1a81a238b17b5366b4580905b3d02457f Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Wed, 14 Aug 2019 12:40:09 +0200 Subject: [PATCH] Fix posting a comment from a note This read the comment and but still posted the note number. --- jan-pona-mute.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jan-pona-mute.py b/jan-pona-mute.py index f952c55..dfe13cd 100755 --- a/jan-pona-mute.py +++ b/jan-pona-mute.py @@ -400,12 +400,13 @@ Use the 'edit' command to edit notes.""" print("Use the 'show' command to show a post, first.") return try: + # if the comment is just a number, use a note to post n = int(line.strip()) notes = self.get_notes() if notes: try: with open(self.get_note_path(notes[n-1]), mode = 'r', encoding = 'utf-8') as fp: - comment = fp.read() + line = fp.read() print("Using note #%d: %s" % (n, notes[n-1])) except IndexError: print("Use the 'list notes' command to list valid numbers.") @@ -414,7 +415,8 @@ Use the 'edit' command to edit notes.""" print("There are no notes to use.") return except ValueError: - comment = line + # in which case we'll simply comment with the line + pass comment = self.post.comment(line) self.post.comments.add(comment) self.undo.append("delete comment %s from %s" % (comment.id, self.post.id)) -- 2.25.1