Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make feed compression optional
Krzysztof Wolski9d3882fb619d
diff --git a/saleor/integrations/feeds.py b/saleor/integrations/feeds.pyindex 119faf4d12..8c5358d44b 100644--- a/saleor/integrations/feeds.py+++ b/saleor/integrations/feeds.py@@ -29,6 +29,7 @@ class GoogleProductFeed(object):"""file_path = path.join(settings.INTEGRATIONS_DIR, 'google-feed.csv.gz')file_url = settings.STATIC_URL + file_path+ compression = Trueattributes = ['id', 'title', 'product_type', 'google_product_category','link', 'image_link', 'condition', 'availability','price', 'tax', 'shipping', 'sale_price',diff --git a/saleor/integrations/utils.py b/saleor/integrations/utils.pyindex 4aa7b13ca2..1ccdad3ed2 100644--- a/saleor/integrations/utils.py+++ b/saleor/integrations/utils.py@@ -6,10 +6,16 @@ from django.core.files.storage import default_storagedef update_feed(feed):with default_storage.open(feed.file_path, 'w') as output_file:- output_compressed = gzip.GzipFile(fileobj=output_file)- writer = csv.DictWriter(output_compressed,feed.attributes,+ if feed.compression:+ output = gzip.GzipFile(fileobj=output_file)+ else:+ output = output_file++ writer = csv.DictWriter(output,feed.attributes,delimiter=str("\t"))writer.writeheader()for item in feed.items():writer.writerow(feed.item_attributes(item))- output_compressed.close()++ if feed.compression:+ output.close()