[python3] Solve glob_to_regex for both py2 and py3
Categories
(Webtools Graveyard :: Pontoon, task)
Tracking
(Not tracked)
People
(Reporter: Pike, Assigned: jotes)
References
Details
Attachments
(1 file)
The code in pontoon.base.utils.glob_to_regex
is affected by the py3 move pretty badly.
$ python -c 'import fnmatch;print(fnmatch.translate("*"))'
.*\Z(?ms)
$ python3 -c 'import fnmatch;print(fnmatch.translate("*"))'
(?s:.*)\Z
I wonder if it's easier to drop fnmatch.translate
and just implement wildcards from scratch?
Assignee | ||
Comment 2•5 years ago
|
||
I've asked about it on IRC a few days ago. Tags module uses glob_to_regex
in some places, it makes easier to resource files.
We've decided to implement something simpler that doesn't need external dependencies.
Reporter | ||
Comment 3•5 years ago
|
||
Maybe some or most of the code in https://github.com/Pike/compare-locales/blob/80d52e763dc1e6a2af54473cb0307e62fd179a9f/compare_locales/paths/matcher.py#L184-L459 can help. Basically does the same thing, take some glob syntax, convert it into a sane regex.
Assignee | ||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Comment 5•4 years ago
|
||
Comment 6•4 years ago
|
||
Searching of resources doesn't work.
Note that we've landed 2 followup patches, which made "Linked" and "Not Linked" resources show up again:
https://bugzilla.mozilla.org/show_bug.cgi?id=1595569
https://bugzilla.mozilla.org/show_bug.cgi?id=1597650
Assignee | ||
Comment 7•4 years ago
|
||
:mathjazz
I can try to fix this if it's not urgent (I'll need a few hours).
Comment 8•4 years ago
|
||
Thanks, let's sync on IRC.
Assignee | ||
Comment 9•4 years ago
|
||
Okay, I'm closing this one because We decided to remove the support for glob patterns in search queries. The fix will be implemented in the follow-up bug.
Updated•3 years ago
|
Description
•