[PATCH 6/6] Validate proxy URLs

David Shea dshea at redhat.com
Tue Apr 1 12:52:20 UTC 2014


On 04/01/2014 04:09 AM, Vratislav Podzimek wrote:
> 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.
>

It's the same class as the iutil part of patch 1, so I can just switch 
it in that one.


More information about the anaconda-patches mailing list