mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Bleach 6 update (#4610)
* Update bleach requirement from ==5.0.* to ==6.2.* Updates the requirements on [bleach](https://github.com/mozilla/bleach) to permit the latest version. - [Changelog](https://github.com/mozilla/bleach/blob/main/CHANGES) - [Commits](https://github.com/mozilla/bleach/compare/v5.0.0...v6.2.0) --- updated-dependencies: - dependency-name: bleach dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Update bleach parameter types * Fix tests --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
@@ -289,7 +289,7 @@ class BaseReportlabInvoiceRenderer(BaseInvoiceRenderer):
|
||||
def _clean_text(self, text, tags=None):
|
||||
return self._normalize(bleach.clean(
|
||||
text,
|
||||
tags=tags or []
|
||||
tags=set(tags) if tags else set()
|
||||
).strip().replace('<br>', '<br />').replace('\n', '<br />\n'))
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ class ClassicInvoiceRenderer(BaseReportlabInvoiceRenderer):
|
||||
def _draw_event(self, canvas):
|
||||
def shorten(txt):
|
||||
txt = str(txt)
|
||||
txt = bleach.clean(txt, tags=[]).strip()
|
||||
txt = bleach.clean(txt, tags=set()).strip()
|
||||
p = Paragraph(self._normalize(txt.strip().replace('\n', '<br />\n')), style=self.stylesheet['Normal'])
|
||||
p_size = p.wrap(self.event_width, self.event_height)
|
||||
|
||||
|
||||
@@ -550,7 +550,7 @@ DEFAULTS = {
|
||||
'serializer_class': serializers.BooleanField,
|
||||
'type': bool,
|
||||
'form_kwargs': dict(
|
||||
label=_("Require a business addresses"),
|
||||
label=_("Require a business address"),
|
||||
help_text=_('This will require users to enter a company name.'),
|
||||
widget=forms.CheckboxInput(attrs={'data-checkbox-dependency': '#id_invoice_address_required'}),
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@ from tlds import tld_set
|
||||
|
||||
register = template.Library()
|
||||
|
||||
ALLOWED_TAGS_SNIPPET = [
|
||||
ALLOWED_TAGS_SNIPPET = {
|
||||
'a',
|
||||
'abbr',
|
||||
'acronym',
|
||||
@@ -68,8 +68,8 @@ ALLOWED_TAGS_SNIPPET = [
|
||||
'strike',
|
||||
's',
|
||||
# Update doc/user/markdown.rst if you change this!
|
||||
]
|
||||
ALLOWED_TAGS = ALLOWED_TAGS_SNIPPET + [
|
||||
}
|
||||
ALLOWED_TAGS = ALLOWED_TAGS_SNIPPET | {
|
||||
'blockquote',
|
||||
'li',
|
||||
'ol',
|
||||
@@ -91,7 +91,7 @@ ALLOWED_TAGS = ALLOWED_TAGS_SNIPPET + [
|
||||
'h6',
|
||||
'pre',
|
||||
# Update doc/user/markdown.rst if you change this!
|
||||
]
|
||||
}
|
||||
|
||||
ALLOWED_ATTRIBUTES = {
|
||||
'a': ['href', 'title', 'class'],
|
||||
@@ -106,7 +106,7 @@ ALLOWED_ATTRIBUTES = {
|
||||
# Update doc/user/markdown.rst if you change this!
|
||||
}
|
||||
|
||||
ALLOWED_PROTOCOLS = ['http', 'https', 'mailto', 'tel']
|
||||
ALLOWED_PROTOCOLS = {'http', 'https', 'mailto', 'tel'}
|
||||
|
||||
URL_RE = SimpleLazyObject(lambda: build_url_re(tlds=sorted(tld_set, key=len, reverse=True)))
|
||||
|
||||
@@ -211,9 +211,9 @@ class CleanPostprocessor(Postprocessor):
|
||||
def run(self, text):
|
||||
return bleach.clean(
|
||||
text,
|
||||
tags=self.tags,
|
||||
tags=set(self.tags),
|
||||
attributes=self.attributes,
|
||||
protocols=self.protocols,
|
||||
protocols=set(self.protocols),
|
||||
strip=self.strip
|
||||
)
|
||||
|
||||
@@ -308,7 +308,7 @@ def markdown_compile_email(source, allowed_tags=ALLOWED_TAGS, allowed_attributes
|
||||
EmailNl2BrExtension(),
|
||||
LinkifyAndCleanExtension(
|
||||
linker,
|
||||
tags=allowed_tags,
|
||||
tags=set(allowed_tags),
|
||||
attributes=allowed_attributes,
|
||||
protocols=ALLOWED_PROTOCOLS,
|
||||
strip=False,
|
||||
|
||||
Reference in New Issue
Block a user