Package pytilities :: Package delegation :: Module delegatorfactory :: Class DelegatorFactory
[hide private]
[frames] | no frames]

Class DelegatorFactory

source code

object --+
         |
        DelegatorFactory

Allows easy creation of delegators with `Profile`s.

By default already has a default profile.

Instance methods:

Class invariants:

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
set_profile(self, name, profile)
Add/replace a delegator factory Profile to/on the factory.
source code
 
Delegator(self, profile_name='default', target=None)
Construct a delegator with a stored Profile.
source code
 
has_profile(self, name)
See if profile with given name exists.
source code
 
get_profile(self, name)
Get profile by name.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

set_profile(self, name, profile)

source code 

Add/replace a delegator factory Profile to/on the factory.

Parameters:

name :: string
name of the profile
profile :: Profile
the profile for addition/replacement

Delegator(self, profile_name='default', target=None)

source code 

Construct a delegator with a stored Profile.

Parameters:

profile_name :: string
name of the Profile to use to set up the delegator with
target = None
target of the newly created delegator

Returns newly created delegator :: Delegator

Raises:

  • ValueError when no profile with name profile_name exists

has_profile(self, name)

source code 

See if profile with given name exists.

Parameters:

name :: string
name of the profile to look for

Returns True if the factory can find a profile by that name, False otherwise

get_profile(self, name)

source code 

Get profile by name.

Parameters:

name :: string
name of the profile

Returns bound profile by name :: Profile

Raises:
  • ValueError when profile isn't found