[master/rhel7-branch] If LANG isn't set, set it to default value. (#997397)

David Shea dshea at redhat.com
Thu Aug 22 13:59:04 UTC 2013


On 08/22/2013 09:41 AM, Samantha N. Bueno wrote:
> Resolves: rhbz#997397
> ---
>   pyanaconda/ui/gui/hubs/progress.py | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py
> index 935c10b..d1da5ee 100644
> --- a/pyanaconda/ui/gui/hubs/progress.py
> +++ b/pyanaconda/ui/gui/hubs/progress.py
> @@ -31,7 +31,7 @@ from pyanaconda.i18n import _
>   from pyanaconda.localization import expand_langs
>   from pyanaconda.product import productName
>   from pyanaconda.flags import flags
> -from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION
> +from pyanaconda.constants import THREAD_INSTALL, THREAD_CONFIGURATION, DEFAULT_LANG
>   from pykickstart.constants import KS_WAIT, KS_SHUTDOWN, KS_REBOOT
>   
>   from pyanaconda.ui.gui.hubs import Hub
> @@ -144,7 +144,14 @@ class ProgressHub(Hub):
>   
>           # We first look for rnotes in paths containing the language, then in
>           # directories without the language component.  You know, just in case.
> -        langs = expand_langs(os.environ["LANG"]) + [""]
> +        try:
> +            langs = expand_langs(os.environ["LANG"]) + [""]
> +        except KeyError:
> +            # if for some reason LANG isn't set to anything, set it to
> +            # the default value
> +            os.environ["LANG"] = DEFAULT_LANG
> +            langs = expand_langs(os.environ["LANG"]) + [""]
> +
>           paths = ["/tmp/updates/pixmaps/rnotes/%s/",
>                    "/tmp/product/pixmaps/rnotes/%s/",
>                    "/usr/share/anaconda/pixmaps/rnotes/%s/"]
Why not use os.environ('LANG', DEFAULT_LANG)?


More information about the anaconda-patches mailing list