-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose adapter classes directly under adapters module
- Loading branch information
Showing
21 changed files
with
62 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
"""Package for defining concrete implementations of Protean""" | ||
# Adapters | ||
from protean.adapters.broker import Brokers | ||
from protean.adapters.broker.celery import CeleryBroker, ProteanTask | ||
from protean.adapters.broker.inline import InlineBroker | ||
from protean.adapters.email import EmailProviders | ||
from protean.adapters.email.dummy import DummyEmailProvider | ||
from protean.adapters.email.sendgrid import SendgridEmailProvider | ||
from protean.adapters.repository import Providers | ||
from protean.adapters.repository.elasticsearch import ESProvider, ElasticsearchModel | ||
from protean.adapters.repository.sqlalchemy import SAProvider, SqlalchemyModel | ||
from protean.adapters.repository.memory import MemoryProvider, MemoryModel | ||
|
||
|
||
__all__ = ( | ||
"Brokers", | ||
"CeleryBroker", | ||
"ProteanTask", | ||
"InlineBroker", | ||
"EmailProviders", | ||
"DummyEmailProvider", | ||
"SendgridEmailProvider", | ||
"Providers", | ||
"ESProvider", | ||
"ElasticsearchModel", | ||
"SAProvider", | ||
"SqlalchemyModel", | ||
"MemoryProvider", | ||
"MemoryModel", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,7 @@ | |
ObjectNotFoundError, | ||
) | ||
from protean.domain.registry import _DomainRegistry | ||
from protean.adapters.broker import Brokers | ||
from protean.adapters.email import Emails | ||
from protean.adapters.repository import Providers | ||
from protean.adapters import Brokers, EmailProviders, Providers | ||
from protean.utils import fully_qualified_name, DomainObjects | ||
from werkzeug.datastructures import ImmutableDict | ||
|
||
|
@@ -87,15 +85,11 @@ class Domain(_PackageBoundObject): | |
"AUTOLOAD_DOMAIN": True, | ||
"IDENTITY_STRATEGY": IdentityStrategy.UUID, | ||
"IDENTITY_TYPE": IdentityType.STRING, | ||
"DATABASES": { | ||
"default": { | ||
"PROVIDER": "protean.adapters.repository.memory.MemoryProvider", | ||
}, | ||
}, | ||
"BROKERS": {"default": {"PROVIDER": "protean.InlineBroker",},}, | ||
"DATABASES": {"default": {"PROVIDER": "protean.adapters.MemoryProvider",},}, | ||
"BROKERS": {"default": {"PROVIDER": "protean.adapters.InlineBroker",},}, | ||
"EMAIL_PROVIDERS": { | ||
"default": { | ||
"PROVIDER": "protean.adapters.email.dummy.DummyEmailProvider", | ||
"PROVIDER": "protean.adapters.DummyEmailProvider", | ||
"DEFAULT_FROM_EMAIL": "[email protected]", | ||
}, | ||
}, | ||
|
@@ -123,7 +117,7 @@ def __init__( | |
|
||
self.providers = Providers(self) | ||
self.brokers = Brokers(self) | ||
self.emails = Emails(self) | ||
self.email_providers = EmailProviders(self) | ||
|
||
# Cache for holding Model to Entity/Aggregate associations | ||
self._models = {} | ||
|
@@ -511,7 +505,7 @@ def get_dao(self, aggregate_cls): | |
####################### | ||
|
||
def get_email_provider(self, provider_name): | ||
return self.emails.get_email_provider(provider_name) | ||
return self.email_providers.get_email_provider(provider_name) | ||
|
||
def send_email(self, email): | ||
return self.emails.send_email(email) | ||
return self.email_providers.send_email(email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
|
||
# Database Configuration | ||
DATABASES = { | ||
"default": {"PROVIDER": "protean.adapters.repository.memory.MemoryProvider"}, | ||
"default": {"PROVIDER": "protean.adapters.MemoryProvider"}, | ||
"sqlite": { | ||
"PROVIDER": "protean.adapters.repository.sqlalchemy.SAProvider", | ||
"DATABASE": Database.SQLITE.value, | ||
|
@@ -40,12 +40,12 @@ | |
|
||
# Messaging Mediums | ||
BROKERS = { | ||
"default": {"PROVIDER": "protean.InlineBroker"}, | ||
"default": {"PROVIDER": "protean.adapters.InlineBroker"}, | ||
} | ||
|
||
EMAIL_PROVIDERS = { | ||
"default": { | ||
"PROVIDER": "protean.adapters.email.dummy.DummyEmailProvider", | ||
"PROVIDER": "protean.adapters.DummyEmailProvider", | ||
"DEFAULT_FROM_EMAIL": "[email protected]", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,9 @@ def test_config_repr(self): | |
"'AUTOLOAD_DOMAIN': True, " | ||
"'IDENTITY_STRATEGY': <IdentityStrategy.UUID: 1>, " | ||
"'IDENTITY_TYPE': <IdentityType.STRING: 'STRING'>, " | ||
"'DATABASES': {'default': {'PROVIDER': 'protean.adapters.repository.memory.MemoryProvider'}}, " | ||
"'BROKERS': {'default': {'PROVIDER': 'protean.InlineBroker'}}, " | ||
"'EMAIL_PROVIDERS': {'default': {'PROVIDER': 'protean.adapters.email.dummy.DummyEmailProvider', " | ||
"'DATABASES': {'default': {'PROVIDER': 'protean.adapters.MemoryProvider'}}, " | ||
"'BROKERS': {'default': {'PROVIDER': 'protean.adapters.InlineBroker'}}, " | ||
"'EMAIL_PROVIDERS': {'default': {'PROVIDER': 'protean.adapters.DummyEmailProvider', " | ||
"'DEFAULT_FROM_EMAIL': '[email protected]'}}, " | ||
"'AGGREGATE_CHILDREN_LIMIT': 100, " | ||
"'TEST_KEY': 'foo'}>" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters