diff options
author | Aarni Koskela <akx@iki.fi> | 2023-03-01 08:25:31 +0200 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-03-01 20:03:40 +0200 |
commit | 0aa54caa0ac47a1bbb5510812d9939344a8f16bb (patch) | |
tree | 11921728f108fdb154aaff59b33cce6c3b6a86d8 /babel | |
parent | 97f89b5e8e11feee3d3e8d8175c79f6c712d5385 (diff) | |
download | babel-0aa54caa0ac47a1bbb5510812d9939344a8f16bb.tar.gz |
Note that `Locale.parse()` does not accept `None`
Refs #977
Diffstat (limited to 'babel')
-rw-r--r-- | babel/core.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/babel/core.py b/babel/core.py index 4cceba9..ba8a621 100644 --- a/babel/core.py +++ b/babel/core.py @@ -280,6 +280,15 @@ class Locale: >>> Locale.parse(l) Locale('de', territory='DE') + If the `identifier` parameter is neither of these, such as `None` + e.g. because a default locale identifier could not be determined, + a `TypeError` is raised: + + >>> Locale.parse(None) + Traceback (most recent call last): + ... + TypeError: ... + This also can perform resolving of likely subtags which it does by default. This is for instance useful to figure out the most likely locale for a territory you can use ``'und'`` as the |