2014-04-25 16:37:51 -07:00
|
|
|
from .base import EmailTransport
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GenericFileMailbox(EmailTransport):
|
2012-06-30 22:30:13 -07:00
|
|
|
_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()
|