Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Code formatting
Adam Janikb0099493d68b
diff --git a/saleor/graphql/account/mutations.py b/saleor/graphql/account/mutations.pyindex bc5f903d7e..cbfefaaf8a 100644--- a/saleor/graphql/account/mutations.py+++ b/saleor/graphql/account/mutations.py@@ -522,7 +522,8 @@ class AddressSetDefault(BaseMutation):address_id = graphene.ID(required=True, description='ID of the address.')user_id = graphene.ID(- required=True, description='ID of the user to change the address for.')+ required=True,+ description='ID of the user to change the address for.')type = AddressTypeEnum(required=True, description='The type of address.')diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.pyindex d0ea8bad37..4929c9bc38 100644--- a/saleor/graphql/core/mutations.py+++ b/saleor/graphql/core/mutations.py@@ -45,7 +45,8 @@ def validation_error_to_error_type(validation_error: ValidationError) -> list:# convert field errorsfor field, field_errors in validation_error.message_dict.items():for err in field_errors:- field = None if field == NON_FIELD_ERRORS else snake_to_camel_case(field)+ field = None if field == NON_FIELD_ERRORS else snake_to_camel_case(+ field)err_list.append(Error(field=field, message=err))else:# convert non-field errors@@ -234,14 +235,14 @@ class ModelMutation(BaseMutation):def is_list_of_ids(field):return (- isinstance(field.type, graphene.List)- and field.type.of_type == graphene.ID)+ isinstance(field.type, graphene.List)+ and field.type.of_type == graphene.ID)def is_id_field(field):return (- field.type == graphene.ID- or isinstance(field.type, graphene.NonNull)- and field.type.of_type == graphene.ID)+ field.type == graphene.ID+ or isinstance(field.type, graphene.NonNull)+ and field.type.of_type == graphene.ID)def is_upload_field(field):if hasattr(field.type, 'of_type'):diff --git a/saleor/graphql/order/mutations/orders.py b/saleor/graphql/order/mutations/orders.pyindex dab120ad7e..2ccd0a5007 100644--- a/saleor/graphql/order/mutations/orders.py+++ b/saleor/graphql/order/mutations/orders.py@@ -22,7 +22,7 @@ def clean_order_update_shipping(order, method):if not order.shipping_address:raise ValidationError({'order': 'Cannot choose a shipping method for an order without '- 'the shipping address.'})+ 'the shipping address.'})valid_methods = (ShippingMethodModel.objects.applicable_shipping_methods(@@ -33,7 +33,7 @@ def clean_order_update_shipping(order, method):if method.pk not in valid_methods:raise ValidationError({'shipping_method':- 'Shipping method cannot be used with this order.'})+ 'Shipping method cannot be used with this order.'})def clean_order_cancel(order):@@ -125,7 +125,7 @@ class OrderUpdateShipping(BaseMutation):if not order.is_draft() and order.is_shipping_required():raise ValidationError({'shipping_method':- 'Shipping method is required for this order.'})+ 'Shipping method is required for this order.'})order.shipping_method = Noneorder.shipping_price = ZERO_TAXED_MONEYdiff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex 406d3fde17..9b767b1904 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -749,7 +749,7 @@ class ProductImageReorder(BaseMutation):if image and image.product != product:raise ValidationError({'order':- 'Image %(image_id)s does not belong to this product.'},+ 'Image %(image_id)s does not belong to this product.'},params={'image_id': image_id})images.append(image)