Набор компонентов для интеграции 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file explicit_python_django-1.0.2.tar.gz
.
File metadata
- Download URL: explicit_python_django-1.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a42677aa8e7dcb3cbf0ba5e816f5017465963652a24a086245d34d10cd6cecde |
|
MD5 | e7ad567b6147b68adf32c6c367655d10 |
|
BLAKE2b-256 | 421d84a956c064d354263adf23ed78f5089dfaab30940bb29cbf6ed0a1bdb607 |
File details
Details for the file explicit_python_django-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: explicit_python_django-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95e48f5f875e68889795f12d7153825c3469adb13a25e4964d6449ef5bd149ca |
|
MD5 | 441ee25da8c6ab57fb517cbde6ffd92b |
|
BLAKE2b-256 | 52b1a9de2c922bd857517a28e797371be85ec19f193ef3dda70ac02ec0a7a610 |