[PATCH 6/6] Validate proxy URLs

Vratislav Podzimek vpodzime at redhat.com
Tue Apr 1 08:09:11 UTC 2014


On Mon, 2014-03-31 at 16:05 -0400, David Shea wrote:
> Translate the proxy parsing error messages so they can be displayed to
> the user instead of logged.
> ---
>  pyanaconda/iutil.py                |  8 +++---
>  pyanaconda/ui/gui/spokes/source.py | 55 +++++++++++++++++++++++++++-----------
>  2 files changed, 45 insertions(+), 18 deletions(-)
> 
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index cc2e945..1945a96 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -37,6 +37,8 @@ from pyanaconda.flags import flags
>  from pyanaconda.constants import DRACUT_SHUTDOWN_EJECT, ROOT_PATH, TRANSLATIONS_UPDATE_DIR, UNSUPPORTED_HW
>  from pyanaconda.regexes import URL_PARSE
>  
> +from pyanaconda.i18n import _
> +
>  import logging
>  log = logging.getLogger("anaconda")
>  program_log = logging.getLogger("program")
> @@ -473,7 +475,7 @@ class ProxyString(object):
>          if url:
>              self.parse_url()
>          elif not host:
> -            raise ProxyStringError("No host url")
> +            raise ProxyStringError(_("No host url"))
>          else:
>              self.parse_components()
>  
> @@ -494,7 +496,7 @@ class ProxyString(object):
>          # 8 = fragment
>          m = URL_PARSE.match(self.url)
>          if not m:
> -            raise ProxyStringError("malformed url, cannot parse it.")
> +            raise ProxyStringError(_("malformed URL, cannot parse it."))
>  
>          # If no protocol was given default to http.
>          if m.group(1):
> @@ -513,7 +515,7 @@ class ProxyString(object):
>              if m.group(5):
>                  self.port = m.group(5)
>          else:
> -            raise ProxyStringError("url has no host component")
> +            raise ProxyStringError(_("URL has no host component"))
This code should use the groupdict() as well. But that's probably
something for an additional patch.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list