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.3.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

explicit_python_django-1.3.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: explicit_python_django-1.3.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for explicit_python_django-1.3.0.tar.gz
Algorithm Hash digest
SHA256 0f2df6649c29efb3b64e1fa79e91f082784d7ee5c38ea31e94afe48968f415bb
MD5 a0141c5ae7d2c90784d953e1c47263eb
BLAKE2b-256 bc419dfba89b402718099c72a7075f9e4ae7a298c5fb085df281bebbf8eb9710

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for explicit_python_django-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39906477e57c5f04cfc1fb744b34835f21a53aec0048233a0e51f7a326c07da9
MD5 f4c3e939608150fad32c94e1a8f122c3
BLAKE2b-256 f8b33b68cbe06572fd00b36b5261732760dfb24edcb762d2cfe9358885ea4fbd

See more details on using hashes here.

Supported by

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