On Tue, Jan 08, 2013 at 01:03:27PM +0100, Vratislav Podzimek wrote:
expand_langs may use parse_langcode which should be a global function not a static method of the Language class. Also some pieces deserve better documentation and some other pieces were potentially dangerous.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/localization.py | 91 +++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 38 deletions(-)
- match = LANGCODE_RE.match(langcode)
- return match.groupdict()
The match could fail. I'd catch that and return an empty {}
- lang_dict = parse_langcode(astring)
- base, loc, enc, script = [lang_dict[key] for key in ("language",
"territory", "codeset", "modifier")]
The key may not be in the lang_dict, add 'if key in lang_dict' to the end of the list comprehension.
Looks good otherwise.