diff options
author | Pierre-Yves Chibon <pingou@pingoured.fr> | 2012-05-14 21:49:51 +0200 |
---|---|---|
committer | Pierre-Yves Chibon <pingou@pingoured.fr> | 2012-05-14 21:49:51 +0200 |
commit | 3ad635377c544f7371647690f467f3be03b48047 (patch) | |
tree | d646c3f246b7438b0870a53504b68a0f86d3bc42 | |
parent | 1e32e3f87ad6efcb6153d61bb7703a7b0c95d358 (diff) | |
download | kittystore-3ad635377c544f7371647690f467f3be03b48047.tar.gz kittystore-3ad635377c544f7371647690f467f3be03b48047.tar.xz kittystore-3ad635377c544f7371647690f467f3be03b48047.zip |
Add method to retrieve all the emails in one thread
-rw-r--r-- | kittystore/kittysastore.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kittystore/kittysastore.py b/kittystore/kittysastore.py index 5e8005e..17e2772 100644 --- a/kittystore/kittysastore.py +++ b/kittystore/kittysastore.py @@ -135,6 +135,25 @@ class KittySAStore(KittyStore): self.metadata) return self.session.query(email).count() + def get_thread(self, list_name, thread_id): + """ Return all the emails present in a thread. This thread + is uniquely identified by its thread_id. + + :arg list_name, name of the mailing list in which this email + should be searched. + :arg thread_id, thread_id as used in the web-pages. + Used here to uniquely identify the thread in the database. + """ + email = get_class_object(list_to_table_name(list_name), 'email', + self.metadata) + mail = None + try: + mail = self.session.query(email).filter_by( + thread_id=thread_id).all() + except NoResultFound: + pass + return mails + def get_thread_length(self, list_name, thread_id): """ Return the number of email present in a thread. This thread is uniquely identified by its thread_id. |