Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Rename FileUploadGraphQLView to GraphQLView
Marcin Gębalae44add72ba31
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.pyindex 11694b9352..7d378ba2c4 100644--- a/saleor/graphql/core/mutations.py+++ b/saleor/graphql/core/mutations.py@@ -11,9 +11,8 @@ from graphql_jwt.exceptions import JSONWebTokenError, PermissionDeniedfrom ...account import modelsfrom ..account.types import User-from ..file_upload.types import Uploadfrom ..utils import get_nodes-from .types.common import Error+from .types import Error, Uploadfrom .utils import snake_to_camel_caseregistry = get_global_registry()diff --git a/saleor/graphql/core/types/__init__.py b/saleor/graphql/core/types/__init__.pyindex 45145df98c..a2da5750a9 100644--- a/saleor/graphql/core/types/__init__.py+++ b/saleor/graphql/core/types/__init__.py@@ -5,3 +5,4 @@ from .common import (from .money import (Money, MoneyRange, ReducedRate, TaxedMoney, TaxedMoneyRange, TaxRateType,VAT)+from .upload import Uploaddiff --git a/saleor/graphql/file_upload/types.py b/saleor/graphql/core/types/upload.pysimilarity index 100%rename from saleor/graphql/file_upload/types.pyrename to saleor/graphql/core/types/upload.pydiff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.pyindex 7c8f891b3d..7a52cbb345 100644--- a/saleor/graphql/product/mutations/products.py+++ b/saleor/graphql/product/mutations/products.py@@ -12,10 +12,8 @@ from ....product.thumbnails import (create_collection_background_image_thumbnails, create_product_thumbnails)from ....product.utils.attributes import get_name_from_attributesfrom ...core.mutations import BaseMutation, ModelDeleteMutation, ModelMutation-from ...core.types.common import Decimal, SeoInput-from ...core.types.money import TaxRateType+from ...core.types import Decimal, SeoInput, TaxRateType, Uploadfrom ...core.utils import clean_seo_fields-from ...file_upload.types import Uploadfrom ...shipping.types import WeightScalarfrom ..types import Category, Collection, Product, ProductImage, ProductVariantfrom ..utils import attributes_to_hstorediff --git a/saleor/graphql/file_upload/views.py b/saleor/graphql/views.pysimilarity index 93%rename from saleor/graphql/file_upload/views.pyrename to saleor/graphql/views.pyindex 323e248225..e2a061ec5b 100644--- a/saleor/graphql/file_upload/views.py+++ b/saleor/graphql/views.py@@ -11,9 +11,13 @@ from graphql.error import GraphQLError, format_error as format_graphql_errorfrom graphql.execution import ExecutionResult-class FileUploadGraphQLView(View):- # This class was inspired by the `FileUploadGraphQLView` class from- # https://github.com/lmcgartland/graphene-file-upload+class GraphQLView(View):+ # This class is our implementation of `graphene_django.views.GraphQLView`,+ # which was extended to support the following features:+ # - Playground as default API explorer (https://github.com/prisma/graphql-playground)+ # - file upload (see `FileUploadGraphQLView`) from https://github.com/lmcgartland/graphene-file-upload+ # - query batching+schema = Noneexecutor = Nonebackend = None@@ -21,11 +25,7 @@ class FileUploadGraphQLView(View):root_value = Nonedef __init__(- self,- schema=None,- executor=None,- middleware=None,- root_value=None,+ self, schema=None, executor=None, middleware=None, root_value=None,backend=None):if schema is None:schema = graphene_settings.SCHEMA@@ -74,9 +74,7 @@ class FileUploadGraphQLView(View):default=200)else:result, status_code = self.get_response(request, data)- return JsonResponse(- data=result,- status=status_code)+ return JsonResponse(data=result, status=status_code, safe=False)def get_response(self, request: HttpRequest, data: dict):query, variables, operation_name = self.get_graphql_params(diff --git a/saleor/urls.py b/saleor/urls.pyindex 78f2b4244f..d8b604c11d 100644--- a/saleor/urls.py+++ b/saleor/urls.py@@ -15,7 +15,7 @@ from .core.urls import urlpatterns as core_urlsfrom .dashboard.urls import urlpatterns as dashboard_urlsfrom .data_feeds.urls import urlpatterns as feed_urlsfrom .graphql.api import schema-from .graphql.file_upload.views import FileUploadGraphQLView+from .graphql.views import GraphQLViewfrom .order.urls import urlpatterns as order_urlsfrom .page.urls import urlpatterns as page_urlsfrom .product.urls import urlpatterns as product_urls@@ -26,7 +26,7 @@ handler404 = 'saleor.core.views.handle_404'non_translatable_urlpatterns = [url(r'^dashboard/',include((dashboard_urls, 'dashboard'), namespace='dashboard')),- url(r'^graphql/', csrf_exempt(FileUploadGraphQLView.as_view(+ url(r'^graphql/', csrf_exempt(GraphQLView.as_view(schema=schema)), name='api'),url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},name='django.contrib.sitemaps.views.sitemap'),