Better Python2.6 compatibility

This commit is contained in:
Manuel Ebert 2013-07-19 13:03:27 +02:00
parent 13f8e668dc
commit 29005c0e07
3 changed files with 4 additions and 4 deletions

View file

@ -152,7 +152,8 @@ class Journal(object):
except ValueError:
# Happens when we can't parse the start of the line as an date.
# In this case, just append line to our body.
current_entry.body += line + "\n"
if current_entry:
current_entry.body += line + "\n"
# Append last entry
if current_entry:
@ -173,7 +174,7 @@ class Journal(object):
lambda match: self._colorize(match.group(0)),
pp, re.UNICODE)
else:
pp = re.sub(r"(?u)([{}]\w+)".format(self.config['tagsymbols']),
pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']),
lambda match: self._colorize(match.group(0)),
pp)
return pp