Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Merge pull request #14488 from saleor/use-ruff-for-pyupgrade

Patryk Zawadzkid16c3f6b112b
diff --cc saleor/graphql/order/bulk_mutations/order_bulk_create.py
index 0f49f753c4,12250c8f94..0db2ea9ac8
--- a/saleor/graphql/order/bulk_mutations/order_bulk_create.py
+++ b/saleor/graphql/order/bulk_mutations/order_bulk_create.py
@@@ -747,18 -745,10 +745,18 @@@ class OrderBulkCreate(BaseMutation, I18
Some systems might have incorrect time that is in the future compared to Saleor.
At the same time, we don't want to create orders that are too far in the future.
"""
- return date < timezone.now() + timedelta(minutes=MINUTES_DIFF)
+ current_time = timezone.now()
+ future_time = current_time + timedelta(minutes=MINUTES_DIFF)
+ if not date.tzinfo:
+ raise ValidationError(
+ message="Input 'date' must be timezone-aware. "
+ "Expected format: 'YYYY-MM-DD HH:MM:SS TZ'.",
+ code=OrderBulkCreateErrorCode.INVALID.value,
+ )
+ return date < future_time
@classmethod
- def is_shipping_required(cls, order_input: Dict[str, Any]) -> bool:
+ def is_shipping_required(cls, order_input: dict[str, Any]) -> bool:
for order_line in order_input["lines"]:
if order_line["is_shipping_required"]:
return True
diff --cc saleor/graphql/product/types/collections.py
index 5444545896,812cdda2f8..ea6f95ad95
--- a/saleor/graphql/product/types/collections.py
+++ b/saleor/graphql/product/types/collections.py
@@@ -1,8 -1,7 +1,8 @@@
from collections import defaultdict
- from typing import List, Optional
+ from typing import Optional
import graphene
+from django.conf import settings
from graphene import relay
from ....permission.enums import ProductPermissions