Name | explicit-python-django JSON |
Version |
1.0.2
JSON |
| download |
home_page | None |
Summary | Набор компонентов для интеграции explicit с django |
upload_time | 2024-11-20 14:14:01 |
maintainer | None |
docs_url | None |
author | BARS Group |
requires_python | None |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Explicit-Django
## Набор компонентов для интеграции Explicit с Django.
### Базовая единица работы на транзакциях Django ORM.
```python
# 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
```python
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)
```
## Запуск тестов
```sh
$ tox
```
>>>>>>> e30984f (EDUEO-552 Вынос интеграции с django в отдельный пакет.)
Raw data
{
"_id": null,
"home_page": null,
"name": "explicit-python-django",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "BARS Group",
"author_email": "education_dev@bars-open.ru",
"download_url": "https://files.pythonhosted.org/packages/42/1d/84a956c064d354263adf23ed78f5089dfaab30940bb29cbf6ed0a1bdb607/explicit_python_django-1.0.2.tar.gz",
"platform": null,
"description": "# Explicit-Django\n## \u041d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Explicit \u0441 Django.\n\n### \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u0445 Django ORM.\n\n```python\n# persons/core/unit_of_work.py\n\nfrom explicit.django.unit_of_work import BaseUnitOfWork\n\nfrom persons.core.persons.adapters.db import Repository as PersonsRepository\nfrom persons.core.persons.adapters.db import repository as persons_repository\n\n# (\u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0440\u0435\u043f\u043e)\nKNOWN_REPOS = (\n ('persons', persons_repository),\n)\n\n\nclass UnitOfWork(BaseUnitOfWork):\n\n persons: PersonsRepository\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self._registry.register(*KNOWN_REPOS)\n```\n\n### \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 Django\n```python\nfrom explicit.django.domain.validation.exceptions import handle_domain_validation_error\n\nclass ViewSet(...):\n\n @handle_domain_validation_error\n def create(self, request, *args, **kwargs):\n command = Command(...)\n bus.handle(command)\n\n```\n## \u0417\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432\n```sh\n$ tox\n```\n>>>>>>> e30984f (EDUEO-552 \u0412\u044b\u043d\u043e\u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 django \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442.)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u041d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 explicit \u0441 django",
"version": "1.0.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52b1a9de2c922bd857517a28e797371be85ec19f193ef3dda70ac02ec0a7a610",
"md5": "441ee25da8c6ab57fb517cbde6ffd92b",
"sha256": "95e48f5f875e68889795f12d7153825c3469adb13a25e4964d6449ef5bd149ca"
},
"downloads": -1,
"filename": "explicit_python_django-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "441ee25da8c6ab57fb517cbde6ffd92b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4566,
"upload_time": "2024-11-20T14:14:00",
"upload_time_iso_8601": "2024-11-20T14:14:00.062690Z",
"url": "https://files.pythonhosted.org/packages/52/b1/a9de2c922bd857517a28e797371be85ec19f193ef3dda70ac02ec0a7a610/explicit_python_django-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "421d84a956c064d354263adf23ed78f5089dfaab30940bb29cbf6ed0a1bdb607",
"md5": "e7ad567b6147b68adf32c6c367655d10",
"sha256": "a42677aa8e7dcb3cbf0ba5e816f5017465963652a24a086245d34d10cd6cecde"
},
"downloads": -1,
"filename": "explicit_python_django-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "e7ad567b6147b68adf32c6c367655d10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4811,
"upload_time": "2024-11-20T14:14:01",
"upload_time_iso_8601": "2024-11-20T14:14:01.656610Z",
"url": "https://files.pythonhosted.org/packages/42/1d/84a956c064d354263adf23ed78f5089dfaab30940bb29cbf6ed0a1bdb607/explicit_python_django-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 14:14:01",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "explicit-python-django"
}