def importCookieConsentSettings(context): """Import cookies consent configurations """ sm = getSiteManager(context.getSite()) if sm is None or not IComponentRegistry.providedBy(sm): logger.info("Can not register components - no site manager found.") return importer = queryMultiAdapter((sm, context), IBody, name=u'rer.cookieconsent') if importer: filename = '%s%s' % (importer.name, importer.suffix) body = context.readDataFile(filename) if body is not None: importer.filename = filename # for error reporting importer.body = body
def _configureCookieConsentBanner(self, node, settings): """Set an ICookieBannerEntry entry in the registry """ bannerconf = CookieBannerEntry() for child in node.childNodes: tagName, name = self.nodedata(child) if name in ('lang', 'text', 'privacy-link-url', 'privacy-link-text', 'dashboard-link-text'): if name=='lang': # check if the language is valid for that site lang = self._getNodeText(child).decode('utf-8') lang_tool = getToolByName(self.context, 'portal_languages') if lang not in lang_tool.getSupportedLanguages(): logger.info("Can't configure %s language in that site" % lang) return setattr(bannerconf, name.replace('-', '_'), self._getNodeText(child).decode('utf-8')) settings.cookie_consent_configuration += (bannerconf,)
def importCookieConsentSettings(context): """Import cookies consent configurations """ sm = getSiteManager(context.getSite()) if sm is None or not IComponentRegistry.providedBy(sm): logger.info("Can not register components - no site manager found.") return importer = queryMultiAdapter( (sm, context), IBody, name=u'rer.cookieconsent' ) if importer: filename = '%s%s' % (importer.name, importer.suffix) body = context.readDataFile(filename) if body is not None: importer.filename = filename # for error reporting importer.body = body
def _configureCookieConsentBanner(self, node, settings): """Set an ICookieBannerEntry entry in the registry """ bannerconf = CookieBannerEntry() for child in node.childNodes: tagName, name = self.nodedata(child) if name in ('lang', 'text', 'privacy-link-url', 'privacy-link-text', 'dashboard-link-text'): if name == 'lang': # check if the language is valid for that site lang = self._getNodeText(child).decode('utf-8') lang_tool = getToolByName(self.context, 'portal_languages') if lang not in lang_tool.getSupportedLanguages(): logger.info( "Can't configure %s language in that site" % lang) return setattr(bannerconf, name.replace('-', '_'), self._getNodeText(child).decode('utf-8')) settings.cookie_consent_configuration += (bannerconf, )