[PATCH 2/2] Fix the langcode parsing regexp
Vratislav Podzimek
vpodzime at redhat.com
Tue Jul 16 13:01:41 UTC 2013
Obviously \w matches the underscore. Also fix the docstring of the
parse_langcode function.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/localization.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py
index 08a9ec6..fe6229f 100644
--- a/pyanaconda/localization.py
+++ b/pyanaconda/localization.py
@@ -34,8 +34,8 @@ LOCALE_CONF_FILE_PATH = "/etc/locale.conf"
#e.g. 'SR_RS.UTF-8 at latin'
LANGCODE_RE = re.compile(r'(?P<language>[A-Za-z]+)'
r'(_(?P<territory>[A-Za-z]+))?'
- r'(\.(?P<encoding>[-\w]+))?'
- r'(@(?P<script>[-\w]+))?')
+ r'(\.(?P<encoding>[-A-Za-z0-9]+))?'
+ r'(@(?P<script>[-A-Za-z0-9]+))?')
class LocalizationConfigError(Exception):
"""Exception class for localization configuration related problems"""
@@ -75,8 +75,8 @@ def parse_langcode(langcode):
'language' : 'SR'
'territory' : 'RS'
- 'codeset' : 'UTF-8'
- 'modifier' : 'latin'
+ 'encoding' : 'UTF-8'
+ 'script' : 'latin'
or None if the given string doesn't match the LANGCODE_RE.
--
1.7.11.7
More information about the anaconda-patches
mailing list