Skip to content

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

Renamed GoogleProductFeed to GoogleMerchant

Krzysztof Wolski32a4c55e8367
diff --git a/saleor/integrations/feeds.py b/saleor/integrations/feeds.py
index 15374c9e53..f43b079eab 100644
--- a/saleor/integrations/feeds.py
+++ b/saleor/integrations/feeds.py
@@ -7,13 +7,13 @@ from django.contrib.sites.models import Site
from django.contrib.syndication.views import add_domain
from django.core.files.storage import default_storage
-from saleor.discount.models import Sale
+from ..discount.models import Sale
from ..product.models import ProductVariant, Category
CATEGORY_SEPARATOR = ' > '
-class GoogleProductFeed(object):
+class GoogleMerchant(object):
"""
Basic Google feed class. To adjust feed to your needs inherit from
this class.
@@ -28,7 +28,7 @@ class GoogleProductFeed(object):
For more info check Google support pages:
https://support.google.com/merchants/answer/7052112?visit_id=1-636148270257062854-1147518273&rd=1
"""
- file_path = path.join(settings.INTEGRATIONS_DIR, 'google-feed.csv.gz')
+ file_path = path.join(settings.INTEGRATIONS_DIR, 'google-merchant.csv.gz')
file_url = default_storage.url(file_path)
compression = True
attributes = ['id', 'title', 'product_type', 'google_product_category',
@@ -192,9 +192,9 @@ class GoogleProductFeed(object):
return product_data
-class SaleorFeed(GoogleProductFeed):
+class SaleorGoogleMerchant(GoogleMerchant):
"""
- Example of using GoogleProductFeed.
+ Example of using GoogleMerchant.
"""
file_path = path.join(settings.INTEGRATIONS_DIR, 'saleor-feed.csv.gz')
file_url = default_storage.url(file_path)
diff --git a/saleor/integrations/management/commands/update_integrations.py b/saleor/integrations/management/commands/update_integrations.py
index d4173a5809..026d8e360c 100644
--- a/saleor/integrations/management/commands/update_integrations.py
+++ b/saleor/integrations/management/commands/update_integrations.py
@@ -2,14 +2,14 @@ from __future__ import unicode_literals
from django.core.management import CommandError, BaseCommand
-from ....integrations.feeds import SaleorFeed
-from ....integrations import utils
+from ...feeds import SaleorGoogleMerchant
+from ... import utils
class Command(BaseCommand):
help = ('Updates integration feeds.'
'If feed name not provided, updates all available feeds')
- feed_classes = {'saleor': SaleorFeed}
+ feed_classes = {'saleor': SaleorGoogleMerchant}
def add_arguments(self, parser):
parser.add_argument('feed_name', nargs='*', type=str, default=None)
diff --git a/saleor/integrations/urls.py b/saleor/integrations/urls.py
index ff82eb6cc4..28b4167c73 100644
--- a/saleor/integrations/urls.py
+++ b/saleor/integrations/urls.py
@@ -1,9 +1,9 @@
from django.conf.urls import url
from django.views.generic.base import RedirectView
-from .feeds import SaleorFeed
+from .feeds import SaleorGoogleMerchant
urlpatterns = [
- url(r'saleor-feed/$', RedirectView.as_view(url=SaleorFeed.file_url),
+ url(r'saleor-feed/$', RedirectView.as_view(url=SaleorGoogleMerchant.file_url),
name='saleor-feed'),
]
diff --git a/tests/test_integrations.py b/tests/test_integrations.py
index 4fa65076cd..1d5ac3b092 100644
--- a/tests/test_integrations.py
+++ b/tests/test_integrations.py
@@ -7,13 +7,13 @@ except ImportError:
from io import StringIO
from saleor.product.models import Category
-from saleor.integrations.feeds import SaleorFeed
+from saleor.integrations.feeds import SaleorGoogleMerchant
from saleor.integrations.utils import update_feed
def test_saleor_feed_items(product_in_stock):
valid_variant = product_in_stock.variants.first()
- feed = SaleorFeed()
+ feed = SaleorGoogleMerchant()
items = feed.items()
assert len(items) == 1
attributes = feed.item_attributes(items[0])
@@ -22,7 +22,7 @@ def test_saleor_feed_items(product_in_stock):
def test_category_formatter(db):
- feed = SaleorFeed()
+ feed = SaleorGoogleMerchant()
main_category = Category(name='Main', slug='main')
main_category.save()
sub_category = Category(name='Sub', slug='sub', parent=main_category)
@@ -39,7 +39,7 @@ def test_feed_updater(product_in_stock, monkeypatch):
fake_file.__enter__ = lambda: fake_file
monkeypatch.setattr('saleor.integrations.utils.default_storage.open',
lambda path, mode: fake_file)
- feed = SaleorFeed()
+ feed = SaleorGoogleMerchant()
feed.compression = False
update_feed(feed)
fake_file.seek(0)