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

Class Url

source code

object --+            
         |            
     Field --+        
             |        
        String --+    
                 |    
           Pattern --+
                     |
                    Url

Note: a 'http://localhost/' does not considered to be a valid url. So any other alias name that you migght use in your local network (and defined in your /etc/hosts file) could possibly be considered invalid.
>>> u = Url('dummy')
>>> u.validate('http://google.com')
True
>>> u.validate('https://google.com')
True
>>> u.validate('http://google.com/')
True
>>> u.validate('http://google.com/some')
True
>>> u.validate('http://google.com/some/more')
True
>>> u.validate('http://google.com/even///more/')
True
>>> u.validate('http://google.com/url/?with=some&args')
True
>>> u.validate('http://google.com/empty/args/?')
True
>>> u.validate('http://google.com/some/;-)?a+b=c&&=11')
True
>>> u.validate('http:/google.com') != True
True
>>> u.validate('mailto://google.com') != True
True
>>> u.validate('http://.google.com') != True
True
>>> u.validate('http://google..com') != True
True
>>> u.validate('http://;-).google.com') != True
True
>>> u.validate('https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=515556794648982')
True
>>> u.validate('http://127.0.0.1:8000/digital/order/continue/')
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= "Url: ")
Overrides: Pattern.validate
(inherited documentation)