Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPT-268 Upgrade to Python 3.9 #39

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.10
3.9.21
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ENV PYENV_ROOT="/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
COPY .python-version .
RUN PYTHON_VERSION="$(cat .python-version)" \
&& git clone --depth 1 -b v2.4.1 https://github.com/pyenv/pyenv.git "${PYENV_ROOT}" \
&& git clone --depth 1 -b v2.4.22 https://github.com/pyenv/pyenv.git "${PYENV_ROOT}" \
&& pyenv install --verbose ${PYTHON_VERSION} \
&& pyenv global ${PYTHON_VERSION} \
&& rm .python-version
Expand Down
10 changes: 10 additions & 0 deletions odoo/tools/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import base64
import collections
import functools
import logging
from lxml.html import clean
import random
Expand All @@ -11,6 +12,7 @@
import threading
import time

import email.utils
from email.utils import getaddresses
from lxml import etree
from werkzeug import urls
Expand All @@ -22,6 +24,14 @@

_logger = logging.getLogger(__name__)

# JobRad: Upgrade to Python 3.9
# Keep the old behavior of getaddresses by specifying strict=False:
# https://docs.python.org/3.9/whatsnew/3.9.html#email
# Note that this is not needed from Odoo 15 onwards:
# https://github.com/jobrad-gmbh/odoo/blob/d7c0516e8c5fdda9661a74099a4085374595f758/odoo/tools/mail.py#L29
if getattr(email.utils, 'supports_strict_parsing', False):
getaddresses = functools.partial(getaddresses, strict=False)

#----------------------------------------------------------
# HTML Sanitizer
#----------------------------------------------------------
Expand Down