diff options
| author | Aurélien Bompard <aurelien@bompard.org> | 2013-11-15 16:14:20 +0100 |
|---|---|---|
| committer | Aurélien Bompard <aurelien@bompard.org> | 2013-11-15 16:14:20 +0100 |
| commit | 453252f27b1739b2c5f36bf4d6201ea63400d390 (patch) | |
| tree | 867e9b991152070954bac45bf458cb0f61fee7ce | |
| parent | d2dd628746492a811075d9385af4afd0a98f86cf (diff) | |
| download | kittystore-453252f27b1739b2c5f36bf4d6201ea63400d390.tar.gz kittystore-453252f27b1739b2c5f36bf4d6201ea63400d390.tar.xz kittystore-453252f27b1739b2c5f36bf4d6201ea63400d390.zip | |
Add an accessor for the email dates
| -rw-r--r-- | kittystore/storm/store.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kittystore/storm/store.py b/kittystore/storm/store.py index b3b150b..cc018ce 100644 --- a/kittystore/storm/store.py +++ b/kittystore/storm/store.py @@ -616,6 +616,23 @@ class StormStore(object): def get_all_messages(self): return self.db.find(Email).order_by(Email.archived_date) + def get_message_dates(self, list_name, start, end): + """ Return all email dates between two given dates. + + :param list_name: The name of the mailing list in which these emails + should be searched. + :param start: A datetime object representing the starting date of + the interval to query. + :param end: A datetime object representing the ending date of + the interval to query. + :returns: The list of messages. + """ + return self.db.find(Email, And( + Email.list_name == unicode(list_name), + Email.date >= start, + Email.date < end, + )).order_by(Desc(Email.date)).values(Email.date) + # Attachments def add_attachment(self, mlist, msg_id, counter, name, content_type, |
