Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use manager from context in order and shop types resolvers
IKarbowiakbb35d5048254
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.pyindex 010dd51e85..60b09aff19 100644--- a/saleor/graphql/order/types.py+++ b/saleor/graphql/order/types.py@@ -17,7 +17,6 @@ from ...graphql.utils import get_user_or_app_from_contextfrom ...order import OrderStatus, modelsfrom ...order.models import FulfillmentStatusfrom ...order.utils import get_order_country, get_valid_shipping_methods_for_order-from ...plugins.manager import get_plugins_managerfrom ...product.templatetags.product_images import get_product_image_thumbnailfrom ...warehouse import models as warehouse_modelsfrom ..account.types import User@@ -824,12 +823,12 @@ class Order(CountableDjangoObjectType):@staticmethod# TODO: We should optimize it in/after PR#5819- def resolve_available_shipping_methods(root: models.Order, _info):+ def resolve_available_shipping_methods(root: models.Order, info):available = get_valid_shipping_methods_for_order(root)if available is None:return []available_shipping_methods = []- manager = get_plugins_manager()+ manager = info.context.pluginsdisplay_gross = display_gross_prices()for shipping_method in available:# Ignore typing check because it is checked indiff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.pyindex 36530897d7..d4521330ef 100644--- a/saleor/graphql/shop/types.py+++ b/saleor/graphql/shop/types.py@@ -10,7 +10,6 @@ from phonenumbers import COUNTRY_CODE_TO_REGION_CODEfrom ... import __version__from ...account import models as account_modelsfrom ...core.permissions import SitePermissions, get_permissions-from ...plugins.manager import get_plugins_managerfrom ...site import models as site_modelsfrom ..account.types import Address, AddressInput, StaffNotificationRecipientfrom ..channel import ChannelContext@@ -209,8 +208,8 @@ class Shop(graphene.ObjectType):)@staticmethod- def resolve_available_payment_gateways(_, _info, currency: Optional[str] = None):- return get_plugins_manager().list_payment_gateways(currency=currency)+ def resolve_available_payment_gateways(_, info, currency: Optional[str] = None):+ return info.context.plugins.list_payment_gateways(currency=currency)@staticmethoddef resolve_available_external_authentications(_, info):