Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make thumbnailer method explicitly required argument
Artur Smęt20024216ba75
diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex 1796f126c7..5e97ccb8b2 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -139,7 +139,7 @@ class Image(graphene.ObjectType):def resolve_url(self, info, size=None):if size:- return get_thumbnail(self, size)+ return get_thumbnail(self, size, method='thumbnail')return self.url@@ -177,7 +177,7 @@ class Product(CountableDjangoObjectType):def resolve_thumbnail_url(self, info, *, size=None):if not size:size = 255- return get_thumbnail(self.get_first_image(), size)+ return get_thumbnail(self.get_first_image(), size, method='thumbnail')def resolve_url(self, info):return self.get_absolute_url()@@ -310,5 +310,5 @@ class ProductImage(CountableDjangoObjectType):def resolve_url(self, info, *, size=None):if size:- return get_thumbnail(self.image, size)+ return get_thumbnail(self.image, size, method='thumbnail')return self.image.urldiff --git a/saleor/product/templatetags/product_images.py b/saleor/product/templatetags/product_images.pyindex b39cc12c64..3c8cf75aff 100644--- a/saleor/product/templatetags/product_images.py+++ b/saleor/product/templatetags/product_images.py@@ -80,7 +80,7 @@ def get_thumbnail_size(size, method):@register.simple_tag()-def get_thumbnail(instance, size, method='thumbnail'):+def get_thumbnail(instance, size, method):if instance:used_size = get_thumbnail_size(size, method)try:diff --git a/templates/cart_dropdown.html b/templates/cart_dropdown.htmlindex d19f6469f5..dae67f4c8a 100644--- a/templates/cart_dropdown.html+++ b/templates/cart_dropdown.html@@ -12,8 +12,8 @@<div class="col-md-10"><a class="link--clean" href="{{ line.variant_url }}"><img class="cart-dropdown__image lazyload lazypreload"- data-src="{% get_thumbnail line.image size=60 %}"- data-srcset="{% get_thumbnail line.image size=60 %} 1x, {% get_thumbnail line.image size=120 %} 2x"+ data-src="{% get_thumbnail line.image size=60 method=thumbnail %}"+ data-srcset="{% get_thumbnail line.image size=60 method=thumbnail %} 1x, {% get_thumbnail line.image size=120 method=thumbnail %} 2x"alt=""src="{% placeholder size=120 %}"><h3>diff --git a/templates/product/details.html b/templates/product/details.htmlindex 8e6353b601..5a840cc36f 100644--- a/templates/product/details.html+++ b/templates/product/details.html@@ -27,7 +27,7 @@<meta property="og:url" content="{{ product_url }}"><link rel="canonical" href="{{ product_url }}">- {% get_thumbnail product.get_first_image size=510 as product_image %}+ {% get_thumbnail product.get_first_image size=510 method=thumbnail as product_image %}{% if product_image %}<meta property="og:image" content="{{ product_image }}" /><meta property="og:image:width" content="510">