2021.4.1 #11

Merged
edraft merged 172 commits from 2021.04.01 into 2021.04 2021-03-21 20:04:24 +01:00
7 changed files with 29 additions and 20 deletions
Showing only changes of commit d1f1627214 - Show all commits

View File

@ -11,7 +11,7 @@ from cpl.configuration.console_argument import ConsoleArgument
from cpl.console.console import Console from cpl.console.console import Console
from cpl.console.foreground_color_enum import ForegroundColorEnum from cpl.console.foreground_color_enum import ForegroundColorEnum
from cpl.environment.application_environment import ApplicationEnvironment from cpl.environment.application_environment import ApplicationEnvironment
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum from cpl.environment.environment_name_enum import EnvironmentNameEnum
@ -32,7 +32,7 @@ class Configuration(ConfigurationABC):
self._handled_args = [] self._handled_args = []
@property @property
def environment(self) -> EnvironmentABC: def environment(self) -> ApplicationEnvironmentABC:
return self._hosting_environment return self._hosting_environment
@property @property

View File

@ -4,7 +4,7 @@ from typing import Type, Union, Optional
from cpl.configuration.console_argument import ConsoleArgument from cpl.configuration.console_argument import ConsoleArgument
from cpl.configuration.configuration_model_abc import ConfigurationModelABC from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import ApplicationEnvironmentABC
class ConfigurationABC(ABC): class ConfigurationABC(ABC):
@ -14,7 +14,7 @@ class ConfigurationABC(ABC):
@property @property
@abstractmethod @abstractmethod
def environment(self) -> EnvironmentABC: pass def environment(self) -> ApplicationEnvironmentABC: pass
@property @property
@abstractmethod @abstractmethod

View File

@ -8,7 +8,7 @@ from cpl.configuration.configuration_model_abc import ConfigurationModelABC
from cpl.database.context.database_context_abc import DatabaseContextABC from cpl.database.context.database_context_abc import DatabaseContextABC
from cpl.dependency_injection.service_abc import ServiceABC from cpl.dependency_injection.service_abc import ServiceABC
from cpl.dependency_injection.service_provider_abc import ServiceProviderABC from cpl.dependency_injection.service_provider_abc import ServiceProviderABC
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import ApplicationEnvironmentABC
class ServiceProvider(ServiceProviderABC): class ServiceProvider(ServiceProviderABC):
@ -31,7 +31,7 @@ class ServiceProvider(ServiceProviderABC):
if issubclass(parameter.annotation, ApplicationRuntimeABC): if issubclass(parameter.annotation, ApplicationRuntimeABC):
params.append(self._app_runtime) params.append(self._app_runtime)
elif issubclass(parameter.annotation, EnvironmentABC): elif issubclass(parameter.annotation, ApplicationEnvironmentABC):
params.append(self._app_runtime.configuration.environment) params.append(self._app_runtime.configuration.environment)
elif issubclass(parameter.annotation, DatabaseContextABC): elif issubclass(parameter.annotation, DatabaseContextABC):

View File

@ -20,7 +20,7 @@ __version__ = '2021.4.1.post1'
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .environment_abc import EnvironmentABC from .environment_abc import ApplicationEnvironmentABC
from .environment_name_enum import EnvironmentNameEnum from .environment_name_enum import EnvironmentNameEnum
from .application_environment import ApplicationEnvironment from .application_environment import ApplicationEnvironment

View File

@ -1,14 +1,19 @@
from socket import gethostname from socket import gethostname
from typing import Optional from typing import Optional
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.environment.environment_name_enum import EnvironmentNameEnum from cpl.environment.environment_name_enum import EnvironmentNameEnum
class ApplicationEnvironment(EnvironmentABC): class ApplicationEnvironment(ApplicationEnvironmentABC):
def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'): def __init__(self, name: EnvironmentNameEnum = EnvironmentNameEnum.production, crp: str = './'):
EnvironmentABC.__init__(self) """
Represents environment of the application
:param name:
:param crp:
"""
ApplicationEnvironmentABC.__init__(self)
self._environment_name: Optional[EnvironmentNameEnum] = name self._environment_name: Optional[EnvironmentNameEnum] = name
self._app_name: Optional[str] = None self._app_name: Optional[str] = None

View File

@ -1,10 +1,14 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
class EnvironmentABC(ABC): class ApplicationEnvironmentABC(ABC):
@abstractmethod @abstractmethod
def __init__(self): pass def __init__(self):
"""
ABC of application environment
"""
pass
@property @property
@abstractmethod @abstractmethod

View File

@ -2,7 +2,7 @@ import ssl
from smtplib import SMTP from smtplib import SMTP
from typing import Optional from typing import Optional
from cpl.environment.environment_abc import EnvironmentABC from cpl.environment.environment_abc import ApplicationEnvironmentABC
from cpl.logging.logger_abc import LoggerABC from cpl.logging.logger_abc import LoggerABC
from cpl.mailing.email import EMail from cpl.mailing.email import EMail
from cpl.mailing.email_client_abc import EMailClientABC from cpl.mailing.email_client_abc import EMailClientABC
@ -12,7 +12,7 @@ from cpl.utils.credential_manager import CredentialManager
class EMailClient(EMailClientABC): class EMailClient(EMailClientABC):
def __init__(self, environment: EnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings): def __init__(self, environment: ApplicationEnvironmentABC, logger: LoggerABC, mail_settings: EMailClientSettings):
""" """
Service to send emails Service to send emails
:param environment: :param environment: