Набор компонентов для интеграции 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
Close
Hashes for explicit_python_django-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fcc79db87de939f644892da6a75faa85e49b8c7528a832976ee90ebc3ed414b |
|
MD5 | 5826d69ec63faee78178abaa92a2d978 |
|
BLAKE2b-256 | 6e35bb7fff94207dd4cf079970c4719a838076d9d3c711f164281f07b668352c |
Close
Hashes for explicit_python_django-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d9041115d512cd76a14cce3f1aae454a3d4607c938e6415bda0b1b685f27bec |
|
MD5 | 407331ede6cce9af9cb3e90c0d9a39d8 |
|
BLAKE2b-256 | 8f9843e04a7050306eb2b327621c4e587027d471813bd4069d0e5860c7510bac |