Fix Python3.11 unit test failures

In Python 3.11, regex have undergone changes in
how they handle Unicode characters. In Python3.11,
global flags must be placed right at the start of a
regular expression. The following regex:

        validators.RegexValidator(r'^(?u)[^/]+$')
must become:
        validators.RegexValidator(r'(?u)^[^/]+$')

Closes-Bug: #2036378
Change-Id: I3884ae5b3a32e33077cf3efeac649ac0c615fdda
This commit is contained in:
manchandavishal 2023-09-20 21:15:13 +05:30
parent d4903226da
commit 1457628e0e

View File

@ -14,7 +14,7 @@ from django.core import validators
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
no_slash_validator = validators.RegexValidator(r'^(?u)[^/]+$', no_slash_validator = validators.RegexValidator(r'(?u)^[^/]+$',
_("Slash is not an allowed " _("Slash is not an allowed "
"character."), "character."),
code="noslash") code="noslash")