From 516b01bb188e3fa23670c1dbc23e670e0c4014a5 Mon Sep 17 00:00:00 2001 From: William Minchin Date: Thu, 2 Jan 2014 18:53:16 -0700 Subject: [PATCH] fix issues on namespace of 'colorama' variable --- jrnl/Journal.py | 5 ++--- jrnl/util.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 531b0784..b42d9ba1 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -168,11 +168,11 @@ class Journal(object): for tag in self.search_tags: tagre = re.compile(re.escape(tag), re.IGNORECASE) pp = re.sub(tagre, - lambda match: util.colorize(match.group(0)), + lambda match: util.colorize(match.group(0), colorama), pp, re.UNICODE) else: pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']), - lambda match: util.colorize(match.group(0)), + lambda match: util.colorize(match.group(0), colorama), pp) return pp @@ -435,4 +435,3 @@ class DayOne(Journal): self._deleted_entries = [e for e in self.entries if e.uuid not in edited_uuids] self.entries[:] = [e for e in self.entries if e.uuid in edited_uuids] return entries - diff --git a/jrnl/util.py b/jrnl/util.py index 6cf7fda1..5f6dca4d 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -139,9 +139,9 @@ def get_text_from_editor(config, template=""): prompt('[Nothing saved to file]') return raw -def colorize(string): +def colorize(string, colorama=None): """Returns the string wrapped in cyan ANSI escape""" if os.name == "nt" and not colorama: return string else: - return u"\033[36m{}\033[39m".format(string) \ No newline at end of file + return u"\033[36m{}\033[39m".format(string)