Source code for shuup.gdpr.resources

# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf import settings
from django.template import loader

from shuup.core.shop_provider import get_shop
from shuup.core.utils.static import get_shuup_static_url
from shuup.gdpr.models import GDPRCookieCategory, GDPRSettings
from shuup.gdpr.utils import get_active_consent_pages, get_privacy_policy_page, should_reconsent_privacy_policy
from shuup.utils.django_compat import is_anonymous, reverse
from shuup.utils.djangoenv import has_installed
from shuup.xtheme.resources import InlineMarkupResource, add_resource


[docs]def valid_view(context): view_class = getattr(context["view"], "__class__", None) if context.get("view") else None if not view_class or not context.get("request"): return False request = context.get("request") if request: match = request.resolver_match if match and match.app_name == "shuup_admin": return False view_name = getattr(view_class, "__name__", "") if view_name == "EditorView": return False return True