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-django-1.0.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

explicit_django-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file explicit-django-1.0.0.tar.gz.

File metadata

  • Download URL: explicit-django-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.7

File hashes

Hashes for explicit-django-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d352450353f761592be09849d1272826c4c22fd54a5b7c3dc1844d3a5b01c7d0
MD5 6cc7f50d8fcd97a36fb4f3710aee689c
BLAKE2b-256 93bb06b4b4d8221e60c96f59c8b21c93081a424e461c600e42f6b4ca549afddd

See more details on using hashes here.

File details

Details for the file explicit_django-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: explicit_django-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.7

File hashes

Hashes for explicit_django-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f1cd9c73f711b363bf1ddb30decb237fd44947921f5e2923100843e3956096f
MD5 9f8e4b4fd56c8ec1e89ee31b4003b7cb
BLAKE2b-256 615ac2c281de79352833ae05fb6b6d0dafc85f74693ded0c327d1e7417dbb394

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