Skip to content

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

Fix mypy errors for data_feeds

IKarbowiak9c13feb3d01b
diff --git a/saleor/data_feeds/google_merchant.py b/saleor/data_feeds/google_merchant.py
index 14c7d611be..e5f8cf36f6 100644
--- a/saleor/data_feeds/google_merchant.py
+++ b/saleor/data_feeds/google_merchant.py
@@ -114,7 +114,7 @@ def item_brand(item: ProductVariant, attributes_dict, attribute_values_dict):
brand = item.product.attributes.get(str(publisher_attribute_pk))
if brand:
- brand_name = attribute_values_dict.get(brand[0])
+ brand_name = attribute_values_dict.get(brand)
if brand_name is not None:
return brand_name
return brand
@@ -158,6 +158,8 @@ def item_google_product_category(item: ProductVariant, category_paths):
https://support.google.com/merchants/answer/6324436
"""
category = item.product.category
+ if not category:
+ raise Exception(f"Item {item} does not have category")
if category.pk in category_paths:
return category_paths[category.pk]
ancestors = [ancestor.name for ancestor in list(category.get_ancestors())]