DescriptorBase

class Cauldron.ext.declarative.descriptor.DescriptorBase(*args, **kwargs)[source] [edit on github]

Bases: object

A keyword descriptor base class which assists in binding descriptors to keywords.

This class should be used as a base class for any class that will use KeywordDescriptor to describe Cauldron keywords as attributes.

This class provides a bind() method to associate a Cauldron Service with the descriptors on this class. There are two stages to binding:

  1. Set the DFW Service for these keywords via bind(). This can be done at the class level.
  2. Bind an instance to the the service. This can be done at __init__ time.

This initalizer tries to bind the instance, if it can.

Methods Summary

bind([service]) Bind a service to the descriptors in this class.
keyword_descriptors() Iterate over the keyword descriptors which are members of this class.

Methods Documentation

bind(service=None)[source] [edit on github]

Bind a service to the descriptors in this class.

This method can be called either on the class or the instance. On the class, it associates a particular Cauldron KTL Service with the the keywords which are attached to this class. For an instance, it associates the Cauldron KTL Service if provided, and links the callback methods appropriately.

Parameters:service – The KTL Cauldron Service, or None, to bind to the keywords attached to this object.
Raises:ServiceNotBound if there is no KTL Cauldron Service associated with this instance.
classmethod keyword_descriptors()[source] [edit on github]

Iterate over the keyword descriptors which are members of this class.