Package foolscap :: Module copyable
[hide private]
[frames] | no frames]

Module copyable

source code

Classes [hide private]
  ICopyable
I represent an object which is passed-by-value across PB connections.
  Copyable
  CopyableSlicer
I handle ICopyable objects (things which are copied by value).
  Copyable2
  RemoteCopyUnslicer
  NonCyclicRemoteCopyUnslicer
  IRemoteCopy
This interface defines what a RemoteCopy class must do.
  RemoteCopyClass
  _RemoteCopyBase
  RemoteCopyOldStyle
  RemoteCopy
  AttributeDictConstraint
This is a constraint for dictionaries that are used for attributes.
Functions [hide private]
 
registerCopier(klass, copier)
This is a shortcut for arranging to serialize third-party clases.
source code
 
registerRemoteCopyUnslicerFactory(typename, unslicerfactory, registry=None)
Tell PB that unslicerfactory can be used to handle Copyable objects that provide a getTypeToCopy name of 'typename'.
source code
 
registerRemoteCopyFactory(typename, factory, stateSchema=None, cyclic=True, registry=None)
Tell PB that 'factory' can be used to handle Copyable objects that provide a getTypeToCopy name of 'typename'.
source code
 
registerRemoteCopy(typename, remote_copy_class, registry=None)
Tell PB that remote_copy_class is the appropriate RemoteCopy class to use when deserializing a Copyable sequence that is tagged with 'typename'.
source code
Variables [hide private]
  CopyableRegistry = {}
  debug_CopyableFactories = {}
  debug_RemoteCopyClasses = {'foolscap.SturdyRef': <class 'fools...
Function Details [hide private]

registerCopier(klass, copier)

source code 

This is a shortcut for arranging to serialize third-party clases. 'copier' must be a callable which accepts an instance of the class you want to serialize, and returns a tuple of (typename, state_dictionary). If it returns a typename of None, the original class's fully-qualified classname is used.

registerRemoteCopyUnslicerFactory(typename, unslicerfactory, registry=None)

source code 

Tell PB that unslicerfactory can be used to handle Copyable objects that provide a getTypeToCopy name of 'typename'. 'unslicerfactory' must be a callable which takes no arguments and returns an object which provides IUnslicer.

registerRemoteCopyFactory(typename, factory, stateSchema=None, cyclic=True, registry=None)

source code 

Tell PB that 'factory' can be used to handle Copyable objects that provide a getTypeToCopy name of 'typename'. 'factory' must be a callable which accepts a state dictionary and returns a fully-formed instance.

'cyclic' is a boolean, which should be set to False to avoid using a Deferred to provide the resulting RemoteCopy instance. This is needed to deserialize Failures (or instances which inherit from one, like CopiedFailure). In exchange for this, it cannot handle reference cycles.

registerRemoteCopy(typename, remote_copy_class, registry=None)

source code 

Tell PB that remote_copy_class is the appropriate RemoteCopy class to use when deserializing a Copyable sequence that is tagged with 'typename'. 'remote_copy_class' should be a RemoteCopy subclass or implement the same interface, which means its constructor takes no arguments and it has a setCopyableState(state) method to actually set the instance's state after initialization. It must also have a nonCyclic attribute.


Variables Details [hide private]

debug_RemoteCopyClasses

Value:
{'foolscap.SturdyRef': <class 'foolscap.referenceable.SturdyRef'>,
 'twisted.python.failure.Failure': <class foolscap.call.CopiedFailure \
at 0x870e08c>}