Package gchecky :: Module gxml :: Class IP
[hide private]
[frames] | no frames]

Class IP

source code

object --+            
         |            
     Field --+        
             |        
        String --+    
                 |    
           Pattern --+
                     |
                    IP

Represents an IP address.

Currently only IPv4 addresses in decimal notation are accepted.
>>> ip = IP('dummy')
>>> ip.validate('127.0.0.1')
True
>>> ip.validate('10.0.0.1')
True
>>> ip.validate('255.17.101.199')
True
>>> ip.validate('1.1.1.1')
True
>>> ip.validate('1.2.3') != True
True
>>> ip.validate('1.2.3.4.5') != True
True
>>> ip.validate('1.2.3.256') != True
True
>>> ip.validate('1.2.3.-1') != True
True
>>> ip.validate('1.2..3') != True
True
>>> ip.validate('.1.2.3.4') != True
True
>>> ip.validate('1.2.3.4.') != True
True
>>> ip.validate('1.2.3.-') != True
True
>>> ip.validate('01.2.3.4') != True
True
>>> ip.validate('1.02.3.4') != True
True


Instance Methods [hide private]
 
__init__(self, path, **kwargs)
Initizlizes a Pattern field.
source code
 
validate(self, data)
Checks if the pattern matches the data.
source code

Inherited from String: data2str, str2data

Inherited from Field: __repr__, create_node_for_path, get_any_node_for_path, get_initial_value, get_nodes_for_path, get_one_node_for_path, load, save

Inherited from Field (private): _traits

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods [hide private]

Inherited from Field: deconstruct_path, reconstruct_path

Instance Variables [hide private]

Inherited from Pattern: pattern

Inherited from Field: default, empty, path, required, save_node_and_xml, values

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path, **kwargs)
(Constructor)

source code 
Initizlizes a Pattern field.
Overrides: Pattern.__init__
(inherited documentation)

validate(self, data)

source code 
Checks if the pattern matches the data.
Decorators:
  • @apply_parent_validation(Pattern, error_prefix= "IP address: ")
Overrides: Pattern.validate
(inherited documentation)