[PATCH rhel7-branch 1/4] Text network spoke: fix ipv4 regex (#909299)

Vratislav Podzimek vpodzime at redhat.com
Tue Aug 27 13:20:47 UTC 2013


On Tue, 2013-08-27 at 14:53 +0200, Radek Vykydal wrote:
> On master I moved the constant in regexps.py.
> 
> ---
>  pyanaconda/ui/tui/spokes/network.py | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
> index a479cc7..4f64b5f 100644
> --- a/pyanaconda/ui/tui/spokes/network.py
> +++ b/pyanaconda/ui/tui/spokes/network.py
> @@ -33,6 +33,7 @@ from pyanaconda.nm import nm_activated_devices, nm_state, nm_devices, nm_device_
>  from gi.repository import NetworkManager
>  
>  import re
> +IPV4_PATTERN_WITHOUT_ANCHORS=r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
>  
>  __all__ = ["NetworkSpoke"]
>  
> @@ -234,17 +235,15 @@ class NetworkSpoke(EditTUISpoke):
>              self.hostname_dialog.value = hostname
>          network.update_hostname_data(self.data, hostname)
>  
> -RE_IPV4="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}"
> -
>  class ConfigureNetworkSpoke(EditTUISpoke):
>      """ Spoke to set various configuration options for net devices. """
>      title = _("Device configuration")
>      category = "network"
>  
>      edit_fields = [
> -        Entry(_('IPv4 address or %s for DHCP' % '"dhcp"'), "ip", re.compile(RE_IPV4+"|dhcp$"), True),
> -        Entry(_("IPv4 netmask"), "netmask", re.compile(RE_IPV4), True),
> -        Entry(_("IPv4 gateway"), "gateway", re.compile(RE_IPV4), True),
> +        Entry(_('IPv4 address or %s for DHCP' % '"dhcp"'), "ip", re.compile("^" + IPV4_PATTERN_WITHOUT_ANCHORS + "|dhcp$"), True),
This line might be worth splitting into two.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list