core: fix Flags not at the start of the expression warnings with new mimetypes_registry
This is follow up of commit 0000dee0 (erp5_core: update mimetypes_registry with shared-mime-info_2.4-5 and media-types_10.1.0., 2024-09-17), after this change, Products.MimetypesRegistry build regular expressions with fnmatch.translate, which on python2 produces regular expressions like: >>> fnmatch.translate('*.aaa') '.*\\.aaa\\Z(?ms) such expressions cause a warning in python3: >>> re.compile('.*\\.aaa\\Z(?ms)') ... re.error: global flags not at the start of the expression at position 9 Running this on python3 would be incompatible with python2, because `fnmatch.translate` on python3 generates regular expressions that are not valid on python2. To solve this mimetypes_registry.xml was edited by hand to move the flags at the beginning, replacing for example '.*\\.aaa\\Z(?ms)' by '(?ms).*\\.aaa\\Z'
Showing
This source diff could not be displayed because it is too large. You can view the blob instead.
-
Owner
This was initially discussed on 463123e4 (comment 217007)
Please register or sign in to comment