forked from mirror/django-mailbox
Adding file-based transports including Maildir, Mbox, Babyl, MH, and MMDF.
This commit is contained in:
parent
6a0305f944
commit
aa0b79b36f
13 changed files with 174 additions and 77 deletions
18
django_mailbox/transports/generic.py
Normal file
18
django_mailbox/transports/generic.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class GenericFileMailbox(object):
|
||||
_variant = None
|
||||
_path = None
|
||||
|
||||
def __init__(self, path):
|
||||
super(GenericFileMailbox, self).__init__()
|
||||
self._path = path
|
||||
|
||||
def get_instance(self):
|
||||
return self._variant(self._path)
|
||||
|
||||
def get_message(self):
|
||||
repository = self.get_instance()
|
||||
repository.lock()
|
||||
for key, message in repository.items():
|
||||
repository.remove(key)
|
||||
yield message
|
||||
repository.unlock()
|
||||
Loading…
Add table
Add a link
Reference in a new issue