Skip to content

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

Drop unused settings

Marcin Gębala69603612b1f1
diff --git a/saleor/demo/settings.py b/saleor/demo/settings.py
index 4c84c74eac..312d372415 100644
--- a/saleor/demo/settings.py
+++ b/saleor/demo/settings.py
@@ -37,8 +37,6 @@ if not (BRAINTREE_API_KEY and BRAINTREE_MERCHANT_ID and BRAINTREE_SECRET_API_KEY
"sandbox configuration in the demo mode with `populatedb` command."
)
-USE_JSON_CONTENT = True
-
PWA_ORIGINS = get_list(os.environ.get("PWA_ORIGINS", "pwa.saleor.io"))
PWA_DASHBOARD_URL_RE = re.compile("^https?://[^/]+/dashboard/.*")
diff --git a/saleor/product/models.py b/saleor/product/models.py
index 115f3130c4..2061e6c436 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -8,7 +8,6 @@ from django.db import models
from django.db.models import Case, Count, F, FilteredRelation, Q, When
from django.urls import reverse
from django.utils.encoding import smart_text
-from django.utils.html import strip_tags
from django.utils.text import slugify
from django_measurement.models import MeasurementField
from django_prices.models import MoneyField
@@ -317,9 +316,7 @@ class Product(SeoModel, ModelWithMetadata, PublishableModel):
@property
def plain_text_description(self) -> str:
- if settings.USE_JSON_CONTENT:
- return json_content_to_raw_text(self.description_json)
- return strip_tags(self.description)
+ return json_content_to_raw_text(self.description_json)
def get_first_image(self):
images = list(self.images.all())
diff --git a/saleor/settings.py b/saleor/settings.py
index e230651b59..80de105e39 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -7,7 +7,6 @@ import dj_email_url
import jaeger_client
import jaeger_client.config
import sentry_sdk
-from django.contrib.messages import constants as messages
from django.core.exceptions import ImproperlyConfigured
from django_prices.utils.formatting import get_currency_fraction
from sentry_sdk.integrations.django import DjangoIntegration
@@ -357,10 +356,6 @@ AVATAX_USE_SANDBOX = get_bool_from_env("AVATAX_USE_SANDBOX", DEBUG)
AVATAX_COMPANY_NAME = os.environ.get("AVATAX_COMPANY_NAME", "DEFAULT")
AVATAX_AUTOCOMMIT = get_bool_from_env("AVATAX_AUTOCOMMIT", False)
-ACCOUNT_ACTIVATION_DAYS = 3
-
-LOGIN_REDIRECT_URL = "home"
-
GOOGLE_ANALYTICS_TRACKING_ID = os.environ.get("GOOGLE_ANALYTICS_TRACKING_ID")
@@ -376,8 +371,6 @@ PAYMENT_MODEL = "order.Payment"
SESSION_SERIALIZER = "django.contrib.sessions.serializers.JSONSerializer"
-MESSAGE_TAGS = {messages.ERROR: "danger"}
-
LOW_STOCK_THRESHOLD = 10
MAX_CHECKOUT_LINE_QUANTITY = int(os.environ.get("MAX_CHECKOUT_LINE_QUANTITY", 50))
@@ -455,8 +448,6 @@ PLACEHOLDER_IMAGES = {
DEFAULT_PLACEHOLDER = "images/placeholder255x255.png"
-LOGOUT_ON_PASSWORD_CHANGE = False
-
SEARCH_BACKEND = "saleor.search.backends.postgresql"
AUTHENTICATION_BACKENDS = [
@@ -488,27 +479,6 @@ REAL_IP_ENVIRON = os.environ.get("REAL_IP_ENVIRON", "REMOTE_ADDR")
# The maximum length of a graphql query to log in tracings
OPENTRACING_MAX_QUERY_LENGTH_LOG = 2000
-# Rich-text editor
-ALLOWED_TAGS = [
- "a",
- "b",
- "blockquote",
- "br",
- "em",
- "h2",
- "h3",
- "i",
- "img",
- "li",
- "ol",
- "p",
- "strong",
- "ul",
-]
-ALLOWED_ATTRIBUTES = {"*": ["align", "style"], "a": ["href", "title"], "img": ["src"]}
-ALLOWED_STYLES = ["text-align"]
-
-
# Slugs for menus precreated in Django migrations
DEFAULT_MENUS = {"top_menu_name": "navbar", "bottom_menu_name": "footer"}
@@ -539,11 +509,6 @@ PLUGINS = [
"saleor.payment.gateways.razorpay.plugin.RazorpayGatewayPlugin",
]
-# Whether DraftJS should be used be used instead of HTML
-# True to use DraftJS (JSON based), for the 2.0 dashboard
-# False to use the old editor from dashboard 1.0
-USE_JSON_CONTENT = get_bool_from_env("USE_JSON_CONTENT", False)
-
if (
not DEBUG
and ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL
diff --git a/tests/api/test_product.py b/tests/api/test_product.py
index 8f02221b31..8ae542880c 100644
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@ -892,13 +892,11 @@ def test_create_product(
category,
size_attribute,
description_json,
- description_raw,
permission_manage_products,
settings,
monkeypatch,
):
query = CREATE_PRODUCT_MUTATION
- settings.USE_JSON_CONTENT = True
description_json = json.dumps(description_json)
@@ -977,14 +975,11 @@ def test_create_product_no_slug_in_input(
category,
size_attribute,
description_json,
- description_raw,
permission_manage_products,
- settings,
monkeypatch,
input_slug,
):
query = CREATE_PRODUCT_MUTATION
- settings.USE_JSON_CONTENT = True
description_json = json.dumps(description_json)
@@ -1312,9 +1307,7 @@ def test_update_product(
non_default_category,
product,
other_description_json,
- other_description_raw,
permission_manage_products,
- settings,
monkeypatch,
color_attribute,
):
@@ -1381,8 +1374,6 @@ def test_update_product(
}
"""
- settings.USE_JSON_CONTENT = True
-
other_description_json = json.dumps(other_description_json)
product_id = graphene.Node.to_global_id("Product", product.pk)
diff --git a/tests/conftest.py b/tests/conftest.py
index 599465717b..8a89e9ba0a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1767,22 +1767,6 @@ def description_json():
}
-def description_raw():
- return """\
-E-commerce for the PWA era
-A modular, high performance e-commerce storefront built with GraphQL, Django, \
-and ReactJS.
-
-Saleor is a rapidly-growing open source e-commerce platform that has served \
-high-volume companies from branches like publishing and apparel since 2012. \
-Based on Python and Django, the latest major update introduces a modular \
-front end with a GraphQL API and storefront and dashboard written in React \
-to make Saleor a full-functionality open source e-commerce.
-
-Get Saleor today!"""
-
-
@pytest.fixture
def other_description_json():
return {
@@ -1813,15 +1797,6 @@ def other_description_json():
}
-def other_description_raw():
- return (
- "A GRAPHQL-FIRST ECOMMERCE PLATFORM FOR PERFECTIONISTS\n"
- "Saleor is powered by a GraphQL server running on top of Python 3 "
- "and a Django 2 framework."
- )
-
-
@pytest.fixture
def service_account(db):
return ServiceAccount.objects.create(name="Sample service account", is_active=True)
diff --git a/tests/settings.py b/tests/settings.py
index 7b7e591c96..6141e455d5 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -49,8 +49,6 @@ COUNTRIES_ONLY = None
MEDIA_ROOT = None
MAX_CHECKOUT_LINE_QUANTITY = 50
-USE_JSON_CONTENT = False
-
AUTH_PASSWORD_VALIDATORS = []
PASSWORD_HASHERS = ["tests.dummy_password_hasher.DummyHasher"]