mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Fix {}
in ''.format()
for python 2.6 which requires an index.
This commit is contained in:
parent
04374d72d0
commit
31765ec3c9
@ -321,22 +321,27 @@ class IPv4Address(object):
|
||||
self.address_str = address_str
|
||||
a = self.address_str.split('.')
|
||||
if len(a) != 4:
|
||||
raise ValueError("IPv4 addresses must be in dotted-quad form.")
|
||||
raise ValueError(
|
||||
'IPv4 addresses must be in dotted-quad form.'
|
||||
)
|
||||
try:
|
||||
self.dotted_quad = [int(a) for a in a]
|
||||
except ValueError, e:
|
||||
raise ValueError("IPv4 addresses must be in dotted-quad form. {}".format(e))
|
||||
raise ValueError(
|
||||
'IPv4 addresses must be in dotted-quad form. {0}'.format(e)
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.address_str
|
||||
|
||||
def __repr__(self):
|
||||
return 'IPv4Address("{}")'.format(str(self))
|
||||
return 'IPv4Address("{0}")'.format(str(self))
|
||||
|
||||
@property
|
||||
def is_private(self):
|
||||
'''
|
||||
:return: Returns True if the address is a non-routable IPv4 address. Otherwise False.
|
||||
:return: Returns True if the address is a non-routable IPv4 address.
|
||||
Otherwise False.
|
||||
'''
|
||||
if 10 == self.dotted_quad[0]:
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user