17.0 vanilla

This commit is contained in:
Ernad Husremovic 2025-10-03 18:05:14 +02:00
parent 2e65bf056a
commit df627a6bba
328 changed files with 578149 additions and 759311 deletions

View file

@ -45,12 +45,12 @@ safe_attrs = defs.safe_attrs | frozenset(
['style',
'data-o-mail-quote', 'data-o-mail-quote-node', # quote detection
'data-oe-model', 'data-oe-id', 'data-oe-field', 'data-oe-type', 'data-oe-expression', 'data-oe-translation-initial-sha', 'data-oe-nodeid',
'data-last-history-steps', 'data-width', 'data-height', 'data-scale-x', 'data-scale-y', 'data-x', 'data-y',
'data-last-history-steps', 'data-oe-protected', 'data-oe-transient-content', 'data-width', 'data-height', 'data-scale-x', 'data-scale-y', 'data-x', 'data-y',
'data-publish', 'data-id', 'data-res_id', 'data-interval', 'data-member_id', 'data-scroll-background-ratio', 'data-view-id',
'data-class', 'data-mimetype', 'data-original-src', 'data-original-id', 'data-gl-filter', 'data-quality', 'data-resize-width',
'data-shape', 'data-shape-colors', 'data-file-name', 'data-original-mimetype',
'data-oe-protected', # editor
'data-behavior-props', 'data-prop-name', # knowledge commands
'data-mimetype-before-conversion',
])
SANITIZE_TAGS = {
# allow new semantic HTML5 tags
@ -455,7 +455,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
html = html.replace('>', '>')
html = html.replace('&lt;', '<')
html = html.replace('&amp;', '&')
html = html.replace('&nbsp;', u'\N{NO-BREAK SPACE}')
html = html.replace('&nbsp;', '\N{NO-BREAK SPACE}')
# strip all lines
html = '\n'.join([x.strip() for x in html.splitlines()])
@ -874,6 +874,33 @@ def encapsulate_email(old_email, new_email):
new_email_split[0][1],
))
def parse_contact_from_email(text):
""" Parse contact name and email (given by text) in order to find contact
information, able to populate records like partners, leads, ...
Supported syntax:
* Raoul <raoul@grosbedon.fr>
* "Raoul le Grand" <raoul@grosbedon.fr>
* Raoul raoul@grosbedon.fr (strange fault tolerant support from
df40926d2a57c101a3e2d221ecfd08fbb4fea30e now supported directly
in 'email_split_tuples';
Otherwise: default, text is set as name.
:return: name, email (normalized if possible)
"""
if not text or not text.strip():
return '', ''
split_results = email_split_tuples(text)
name, email = split_results[0] if split_results else ('', '')
if email:
email_normalized = email_normalize(email, strict=False) or email
else:
name, email_normalized = text, ''
return name, email_normalized
def unfold_references(msg_references):
""" As it declared in [RFC2822] long header bodies can be "folded" using
CRLF+WSP. Some mail clients split References header body which contains