Skip to content

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

Replace warning strings with warnings

IKarbowiak77afb1920bb2
diff --git a/saleor/graphql/middleware.py b/saleor/graphql/middleware.py
index 33f7bf713a..becca10e14 100644
--- a/saleor/graphql/middleware.py
+++ b/saleor/graphql/middleware.py
@@ -69,9 +69,11 @@ def process_view(self, request, view_func, *args):
if settings.ENABLE_DEBUG_TOOLBAR:
+ import warnings
+
try:
from graphiql_debug_toolbar.middleware import DebugToolbarMiddleware
except ImportError:
- """The graphiql debug toolbar was not installed."""
+ warnings.warn("The graphiql debug toolbar was not installed.")
else:
DebugToolbarMiddleware.process_view = process_view
diff --git a/saleor/urls.py b/saleor/urls.py
index 508ad541e4..1967fb84eb 100644
--- a/saleor/urls.py
+++ b/saleor/urls.py
@@ -48,11 +48,15 @@ translatable_urlpatterns = [
urlpatterns = non_translatable_urlpatterns + i18n_patterns(*translatable_urlpatterns)
if settings.DEBUG:
+ import warnings
+
try:
import debug_toolbar
except ImportError:
- """The debug toolbar was not installed. Ignore the error.
- settings.py should already have warned the user about it."""
+ warnings.warn(
+ "The debug toolbar was not installed. Ignore the error. \
+ settings.py should already have warned the user about it."
+ )
else:
urlpatterns += [url(r"^__debug__/", include(debug_toolbar.urls))]