From 42373760ffdb0bba804407fffe1a373c6c071e96 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 16 Apr 2022 16:17:15 -0700 Subject: [PATCH] change print statement over to new print_msg function --- jrnl/Journal.py | 16 +++++++++++++--- jrnl/messages.py | 5 +++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index bf446a92..f96db88b 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -12,6 +12,11 @@ from . import Entry from . import time from .prompt import yesno +from jrnl.output import print_msg +from jrnl.messages import Message +from jrnl.messages import MsgText +from jrnl.messages import MsgType + class Tag: def __init__(self, name, count=0): @@ -408,9 +413,14 @@ def open_journal(journal_name, config, legacy=False): if os.path.isdir(config["journal"]): if config["encrypt"]: - print( - "Warning: This journal's config has 'encrypt' set to true, but this type of journal can't be encrypted.", - file=sys.stderr, + print_msg( + Message( + MsgText.ConfigEncryptedForUnencryptableJournalType, + MsgType.WARNING, + { + "journal_name": journal_name, + }, + ) ) if config["journal"].strip("/").endswith(".dayone") or "entries" in os.listdir( diff --git a/jrnl/messages.py b/jrnl/messages.py index 335c7b54..7d815fe8 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -60,6 +60,11 @@ class MsgText(Enum): this journal to the new journal, then encrypt the new journal. """ + ConfigEncryptedForUnencryptableJournalType = """ + The config for journal "{journal_name}" has 'encrypt' set to true, but this type + of journal can't be encrypted. Please fix your config file. + """ + KeyboardInterruptMsg = "Aborted by user" CantReadTemplate = """