Closed derfryday closed 3 years ago
Thank you for this report (and fix!) this is a case of building for one set of defaults and then setting a different bunch of values in the CLI, and not really accounting for either 😅 oops.
There's definitely other places this can happen that are due an update but locale is the first one to actually get overriden, so it makes sense! I'll pick up on your PR.
seeing as this patches some broken behaviour i'm going to package as patchv1.21.1
, and ship over the next day or so! I'll update here.
lovely, thanks!
Describe the bug You can't set the locale via the strategyfile because it will always be overwritten by the fallback locale
To Reproduce Steps to reproduce the behavior:
de_DE
state
--fake-locale
argument but enable verbose to see that the locale will fall back toen_GB
Expected behavior settings the locale in the strategyfile results in that locale being used by pynonmizer.
Additional context The issue seemingly lies in pynonymizer/pynonymize.py:47
fake_locale will never be
None
beyond this point, it's either a value specified by the CLI argument/environment variable or the fallbacken_GB
the
parse_config
method relies onlocal_override
to beNone
to use the value set in the strategyfile.pynonymizer/strategy/parser.py:162
I'd suggest to put the fallback to
en_GB
into the line where the locale is being read from the strategyfile instead of the fallback logic from pynonymizer/pynonymize.py:47.I've created a pull request with the suggested changes: https://github.com/jerometwell/pynonymizer/pull/79