forked from mirror/django-mailbox
wrong folder stage
This commit is contained in:
parent
a52f20dabe
commit
50ee86d1d9
69 changed files with 4191 additions and 85 deletions
26
build/lib/django_mailbox/transports/generic.py
Normal file
26
build/lib/django_mailbox/transports/generic.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import sys
|
||||
|
||||
from .base import EmailTransport
|
||||
|
||||
|
||||
class GenericFileMailbox(EmailTransport):
|
||||
_variant = None
|
||||
_path = None
|
||||
|
||||
def __init__(self, path):
|
||||
super().__init__()
|
||||
self._path = path
|
||||
|
||||
def get_instance(self):
|
||||
return self._variant(self._path)
|
||||
|
||||
def get_message(self, condition=None):
|
||||
repository = self.get_instance()
|
||||
repository.lock()
|
||||
for key, message in repository.items():
|
||||
if condition and not condition(message):
|
||||
continue
|
||||
repository.remove(key)
|
||||
yield message
|
||||
repository.flush()
|
||||
repository.unlock()
|
||||
Loading…
Add table
Add a link
Reference in a new issue