Features: 1) Add exception handling for Category.MultipleObjectsReturned and Brand.MultipleObjectsReturned; 2) Add aiosmtpd dependency to pyproject.toml.

Fixes: None;

Extra: 1) Update poetry.lock for the new aiosmtpd package; 2) Perform formatting changes to json and hash entries in poetry.lock for consistency.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-09 06:53:53 +03:00
parent fb91243718
commit 695058128e
3 changed files with 35 additions and 4 deletions

View file

@ -106,6 +106,8 @@ class AbstractVendor:
pass pass
except IndexError: except IndexError:
pass pass
except Category.MultipleObjectsReturned:
pass
categories = Category.objects.filter(name=category_name) categories = Category.objects.filter(name=category_name)
if not categories.exists(): if not categories.exists():
return Category.objects.create(name=category_name, is_active=False) return Category.objects.create(name=category_name, is_active=False)
@ -127,6 +129,8 @@ class AbstractVendor:
pass pass
except IndexError: except IndexError:
pass pass
except Brand.MultipleObjectsReturned:
pass
brands = Brand.objects.filter(name=brand_name) brands = Brand.objects.filter(name=brand_name)
if not brands.exists(): if not brands.exists():
return Brand.objects.create(name=brand_name, is_active=False) return Brand.objects.create(name=brand_name, is_active=False)

34
poetry.lock generated
View file

@ -1,5 +1,20 @@
# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. # This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand.
[[package]]
name = "aiosmtpd"
version = "1.4.6"
description = "aiosmtpd - asyncio based SMTP server"
optional = false
python-versions = ">=3.8"
files = [
{ file = "aiosmtpd-1.4.6-py3-none-any.whl", hash = "sha256:72c99179ba5aa9ae0abbda6994668239b64a5ce054471955fe75f581d2592475" },
{ file = "aiosmtpd-1.4.6.tar.gz", hash = "sha256:5a811826e1a5a06c25ebc3e6c4a704613eb9a1bcf6b78428fbe865f4f6c9a4b8" },
]
[package.dependencies]
atpublic = "*"
attrs = "*"
[[package]] [[package]]
name = "amqp" name = "amqp"
version = "5.3.1" version = "5.3.1"
@ -173,6 +188,17 @@ files = [
{ file = "async_lru-2.0.5.tar.gz", hash = "sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb" }, { file = "async_lru-2.0.5.tar.gz", hash = "sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb" },
] ]
[[package]]
name = "atpublic"
version = "6.0.1"
description = "Keep all y'all's __all__'s in sync"
optional = false
python-versions = ">=3.9"
files = [
{ file = "atpublic-6.0.1-py3-none-any.whl", hash = "sha256:f9a23902faf5ca1fdc6436b3712d79452f71abc61a810d22be1f31b40a8004c5" },
{ file = "atpublic-6.0.1.tar.gz", hash = "sha256:718932844f5bdfdf5d80ad4c64e13964f22274b4f8937d54a8d3811d6bc5dc05" },
]
[[package]] [[package]]
name = "attrs" name = "attrs"
version = "25.3.0" version = "25.3.0"
@ -2713,13 +2739,13 @@ xmp = ["defusedxml"]
[[package]] [[package]]
name = "platformdirs" name = "platformdirs"
version = "4.3.7" version = "4.3.8"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = true optional = true
python-versions = ">=3.9" python-versions = ">=3.9"
files = [ files = [
{ file = "platformdirs-4.3.7-py3-none-any.whl", hash = "sha256:a03875334331946f13c549dbd8f4bac7a13a50a895a0eb1e8c6a8ace80d40a94" }, { file = "platformdirs-4.3.8-py3-none-any.whl", hash = "sha256:ff7059bb7eb1179e2685604f4aaf157cfd9535242bd23742eadc3c13542139b4" },
{ file = "platformdirs-4.3.7.tar.gz", hash = "sha256:eb437d586b6a0986388f0d6f74aa0cde27b48d0e3d66843640bfb6bdcdb6e351" }, { file = "platformdirs-4.3.8.tar.gz", hash = "sha256:3d512d96e16bcb959a814c9f348431070822a6496326a4be0911c40b5a74c2bc" },
] ]
[package.extras] [package.extras]
@ -4037,4 +4063,4 @@ worker = ["celery", "django-celery-beat"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.12,<3.13" python-versions = ">=3.12,<3.13"
content-hash = "4079e4ea32df5c36446f1a1bc151c2f6c17afac4fc686d188370d643c2a56e6d" content-hash = "89b9f7bb15a0af66b49f2567e975289dc3f0e12a1fe07c1b7afe323ffb018970"

View file

@ -23,6 +23,7 @@ requests = "2.32.3"
gunicorn = "23.0.0" gunicorn = "23.0.0"
psycopg2 = "2.9.10" psycopg2 = "2.9.10"
polib = "1.2.0" polib = "1.2.0"
aiosmtpd = "1.4.6"
openai = { version = "1.77.0", optional = true } openai = { version = "1.77.0", optional = true }
swapper = "1.4.0" swapper = "1.4.0"
paramiko = "3.5.1" paramiko = "3.5.1"