1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-10 06:48:19 +02:00
This commit is contained in:
Adam Dobrawy 2020-12-08 09:09:23 +05:30 committed by GitHub
commit da014f5618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 0 deletions

View file

@ -8,3 +8,4 @@ from django_mailbox.transports.babyl import BabylTransport
from django_mailbox.transports.mh import MHTransport
from django_mailbox.transports.mmdf import MMDFTransport
from django_mailbox.transports.gmail import GmailImapTransport
from django_mailbox.transports.registry import registry, register

View file

@ -9,3 +9,10 @@ class EmailTransport:
message = email.message_from_bytes(contents)
return message
class PluggableEmailTransport(EmailTransport):
@classmethod
def from_uri(cls, uri):
raise NotImplemented("The class does not implement {0}.from_uri, and it should. "
"Overwrite {0}.from_uri.".format(cls.__name__))

View file

@ -0,0 +1,8 @@
registry = {}
def register(transport_type):
def decorator(f):
registry[transport_type] = f
return f
return decorator