This commit is contained in:
Manuel Ebert 2012-05-21 11:21:42 +02:00
parent 6bf5c6e935
commit ba58d73ff0

View file

@ -172,7 +172,7 @@ class Journal:
entries = [] entries = []
current_entry = None current_entry = None
for line in journal.split(os.linesep): for line in journal.splitlines():
try: try:
# try to parse line as date => new entry begins # try to parse line as date => new entry begins
new_date = datetime.strptime(line[:date_length], self.config['timeformat']) new_date = datetime.strptime(line[:date_length], self.config['timeformat'])
@ -184,7 +184,7 @@ class Journal:
except ValueError: except ValueError:
# Happens when we can't parse the start of the line as an date. # Happens when we can't parse the start of the line as an date.
# In this case, just append line to our body. # In this case, just append line to our body.
current_entry.body += line + os.linesep current_entry.body += line + "\n"
# Append last entry # Append last entry
if current_entry: if current_entry:
@ -233,7 +233,7 @@ class Journal:
def write(self, filename = None): def write(self, filename = None):
"""Dumps the journal into the config file, overwriting it""" """Dumps the journal into the config file, overwriting it"""
filename = filename or self.config['journal'] filename = filename or self.config['journal']
journal = os.linesep.join([str(e) for e in self.entries]) journal = "\n".join([str(e) for e in self.entries])
if self.config['encrypt']: if self.config['encrypt']:
journal = self._encrypt(journal) journal = self._encrypt(journal)
with open(filename, 'w') as journal_file: with open(filename, 'w') as journal_file: