diff --git a/jrnl/Journal.py b/jrnl/Journal.py index 9b568ee4..cbbcbf54 100644 --- a/jrnl/Journal.py +++ b/jrnl/Journal.py @@ -36,6 +36,10 @@ class Journal(object): """Returns the number of entries""" return len(self.entries) + def __iter__(self): + """Iterates over the journal's entries.""" + return (entry for entry in self.entries) + @classmethod def from_journal(cls, other): """Creates a new journal by copying configuration and entries from diff --git a/jrnl/plugins/text_exporter.py b/jrnl/plugins/text_exporter.py index 6e550956..6a904436 100644 --- a/jrnl/plugins/text_exporter.py +++ b/jrnl/plugins/text_exporter.py @@ -17,12 +17,12 @@ class TextExporter(BaseExporter): @classmethod def export_entry(cls, entry): """Returns a unicode representation of a single entry.""" - return u.__unicode__() + return entry.__unicode__() @classmethod def export_journal(cls, journal): """Returns a unicode representation of an entire journal.""" - return journal.pprint() + return "\n".join(cls.export_entry(entry) for entry in journal) @classmethod def write_file(cls, journal, path):