explicit-python-django


Nameexplicit-python-django JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryНабор компонентов для интеграции explicit с django
upload_time2024-10-02 09:56:27
maintainerNone
docs_urlNone
authorBARS Group
requires_pythonNone
licenseMIT
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/6e/35/bb7fff94207dd4cf079970c4719a838076d9d3c711f164281f07b668352c/explicit_python_django-1.0.1.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.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f9843e04a7050306eb2b327621c4e587027d471813bd4069d0e5860c7510bac",
                "md5": "407331ede6cce9af9cb3e90c0d9a39d8",
                "sha256": "6d9041115d512cd76a14cce3f1aae454a3d4607c938e6415bda0b1b685f27bec"
            },
            "downloads": -1,
            "filename": "explicit_python_django-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "407331ede6cce9af9cb3e90c0d9a39d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4566,
            "upload_time": "2024-10-02T09:56:25",
            "upload_time_iso_8601": "2024-10-02T09:56:25.748838Z",
            "url": "https://files.pythonhosted.org/packages/8f/98/43e04a7050306eb2b327621c4e587027d471813bd4069d0e5860c7510bac/explicit_python_django-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e35bb7fff94207dd4cf079970c4719a838076d9d3c711f164281f07b668352c",
                "md5": "5826d69ec63faee78178abaa92a2d978",
                "sha256": "9fcc79db87de939f644892da6a75faa85e49b8c7528a832976ee90ebc3ed414b"
            },
            "downloads": -1,
            "filename": "explicit_python_django-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5826d69ec63faee78178abaa92a2d978",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4784,
            "upload_time": "2024-10-02T09:56:27",
            "upload_time_iso_8601": "2024-10-02T09:56:27.227622Z",
            "url": "https://files.pythonhosted.org/packages/6e/35/bb7fff94207dd4cf079970c4719a838076d9d3c711f164281f07b668352c/explicit_python_django-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-02 09:56:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "explicit-python-django"
}
        
Elapsed time: 0.35537s