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

Class Any

source code

object --+    
         |    
     Field --+
             |
            Any

Any text value. This field is tricky. Since any data could be stored in
the field we can't handle all the cases.
The class uses xml.marshal.generic to convert python-ic simple data
structures into xml. By simple we mean any POD. Note that a class derived
from object requires the marshaller to be extended that's why this field
does not accept instance of such classes.
When reading XML we consider node XML text as if it was previously
generated by a xml marshaller facility (xml.marshal.generic.dumps).
If it fails then we consider the data as if it was produced by some other
external source and return False indicating that user Controller should
parse the XML data itself. In such case field value is False.
To access the original XML input two class member variables are populated:
- <field>_xml contains the original XML text
- <field>_dom contains the corresponding XML DOM node



Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Specify initial parameters for this field instance.
source code
 
save(self, node, data)
Save the field data value into the DOM node.
source code
 
load(self, node)
Load the field data from the xml DOM node.
source code
 
validate(self, data)
Validate data according to this fields parameters.
source code

Inherited from Field: __repr__, create_node_for_path, data2str, get_any_node_for_path, get_initial_value, get_nodes_for_path, get_one_node_for_path, str2data

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 Field: default, empty, path, required, save_node_and_xml, values

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 
Specify initial parameters for this field instance. The list of actual parameters depends on the subclass.
Overrides: Field.__init__
(inherited documentation)

save(self, node, data)

source code 
Save the field data value into the DOM node. The value is stored accordingly to the field path which could be the DOM node itself or its subnodes (which will be automatically created), or (a sub)node attribute.
Overrides: Field.save
(inherited documentation)

load(self, node)

source code 
Load the field data from the xml DOM node. The value is retrieved accordingly to the field path and other traits.
Overrides: Field.load
(inherited documentation)

validate(self, data)

source code 

Validate data according to this fields parameters.

@return True if data is ok, otherwise return a string (!) describing
        why the data is invalid.

Note that this method returns either True or an error string, not False!

The Field class considers any data as valid and returns True.

Overrides: Field.validate
(inherited documentation)