Fix Locale subclass __str__ issue - #1271
Conversation
akx
left a comment
There was a problem hiding this comment.
Instead of duplicating the get_locale_identifier invocation from __str__, maybe we should add a new @property called _identifier and use it in both places?
|
@akx imo that would change the standard usage of the existing I think @Chiifouu's solution is good for this case, it doesn't modify the existing standard but does decouple |
I don't see how - you'd use
As far as I can see, there's only one call site that uses the Locale instance's values, and that's
In my eyes, it'll be the one canonical way to get the instance's full locale identifier, even if To be clear, I mean |
Fixes #1252
I noticed that Locale.init was using str(self) to build the identifier. This breaks when a subclass overrides str with a custom format.
This PR replaces it with get_locale_identifier() and adds a small test to make sure subclassed Locale objects work correctly.