Skip to main content

Набор компонентов для интеграции explicit с django

Project description

Explicit-Django

Набор компонентов для интеграции Explicit с Django.

Базовая единица работы на транзакциях Django ORM.

# persons/core/unit_of_work.py

from explicit.django.unit_of_work import BaseUnitOfWork

from persons.core.persons.adapters.db import Repository as PersonsRepository
from persons.core.persons.adapters.db import repository as persons_repository

# (имя атрибута, инстанс репо)
KNOWN_REPOS = (
    ('persons', persons_repository),
)


class UnitOfWork(BaseUnitOfWork):

    persons: PersonsRepository

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._registry.register(*KNOWN_REPOS)

Декоратор для преобразования ошибок валидации предметной области в ошибки валидации Django

from explicit.django.domain.validation.exceptions import handle_domain_validation_error

class ViewSet(...):

   @handle_domain_validation_error
   def create(self, request, *args, **kwargs):
       command = Command(...)
       bus.handle(command)

Запуск тестов

$ tox

e30984f (EDUEO-552 Вынос интеграции с django в отдельный пакет.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

explicit_python_django-1.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

explicit_python_django-1.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file explicit_python_django-1.0.2.tar.gz.

File metadata

File hashes

Hashes for explicit_python_django-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a42677aa8e7dcb3cbf0ba5e816f5017465963652a24a086245d34d10cd6cecde
MD5 e7ad567b6147b68adf32c6c367655d10
BLAKE2b-256 421d84a956c064d354263adf23ed78f5089dfaab30940bb29cbf6ed0a1bdb607

See more details on using hashes here.

File details

Details for the file explicit_python_django-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for explicit_python_django-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95e48f5f875e68889795f12d7153825c3469adb13a25e4964d6449ef5bd149ca
MD5 441ee25da8c6ab57fb517cbde6ffd92b
BLAKE2b-256 52b1a9de2c922bd857517a28e797371be85ec19f193ef3dda70ac02ec0a7a610

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page