Package foolscap :: Module call :: Class FailureConstraint
[hide private]
[frames] | no frames]

Class FailureConstraint

source code

   constraint.Constraint --+        
                           |        
 constraint.OpenerConstraint --+    
                               |    
copyable.AttributeDictConstraint --+
                                   |
                                  FailureConstraint

Nested Classes [hide private]
  klass
A basic abstraction for an error that has occurred.
Instance Methods [hide private]
 
__init__(self) source code
 
checkObject(self, obj, inbound)
Validate an existing object.
source code

Inherited from copyable.AttributeDictConstraint: getAttrConstraint, maxDepth, maxSize

Inherited from constraint.Constraint: OPENBYTES, __providedBy__, checkOpentype, checkToken, setNumberTaster

Class Variables [hide private]
  opentypes = [('copyable', 'twisted.python.failure.Failure')]
opentypes is a list of currently acceptable OPEN token types.
  name = 'FailureConstraint'
Used to describe the Constraint in a Violation error message

Inherited from constraint.OpenerConstraint: __implemented__, __provides__, taster

Inherited from constraint.Constraint: COUNTERBYTES, strictTaster

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: copyable.AttributeDictConstraint.__init__

checkObject(self, obj, inbound)

source code 

Validate an existing object. Usually objects are validated as their tokens come off the wire, but pre-existing objects may be added to containers if a REFERENCE token arrives which points to them. The older objects were were validated as they arrived (by a different schema), but now they must be re-validated by the new schema.

A more naive form of validation would just accept the entire object tree into memory and then run checkObject() on the result. This validation is too late: it is vulnerable to both DoS and made-you-run-code attacks.

If inbound=True, this object is arriving over the wire. If inbound=False, this is being called to validate an existing object before it is sent over the wire. This is done as a courtesy to the remote end, and to improve debuggability.

Most constraints can use the same checker for both inbound and outbound objects.

Overrides: constraint.Constraint.checkObject
(inherited documentation)