Package pytilities :: Package delegation :: Module decorators
[hide private]
[frames] | no frames]

Module decorators

source code

Various decorators to ease delegation
Functions [hide private]
 
delegator_factory()
Makes a DelegatorFactory on the class and adds profiles to it.
source code
 
delegated(profile_name='default', modifiers='rwd')
Includes the decorated attribute in the specified delegation profile.
source code
Variables [hide private]
  _logger = logging.getLogger("pytilities.delegation")
  __package__ = 'pytilities.delegation'
Function Details [hide private]

delegator_factory()

source code 

Makes a DelegatorFactory on the class and adds profiles to it.

The factory is stored as a class attribute with name _delegator_factory. A Delegator method is installed on the class, it is the same as _delegator_factory.Delegator.

Profile`s are created based on the annotations left by `delegated.

delegated(profile_name='default', modifiers='rwd')

source code 

Includes the decorated attribute in the specified delegation profile.

Parameters:

profile_name :: string
name of the Profile to add the attribute to
modifiers :: string

the types of access to delegate to the target. Possible modifiers are combinations of:

  • r: read
  • w: write
  • d: delete