Package nbxmpp :: Module plugin :: Class PlugIn

[hide private]
[frames] | no frames]

# Class PlugIn

source code

Abstract xmpppy plugin infrastructure code, providing plugging in/out and debugging functionality

Inherit to develop pluggable objects. No code change on the owner class required (the object where we plug into)

For every instance of PlugIn class the 'owner' is the class in what the plug was plugged.

Instance Methods | [hide private]

__init__(self) | source code

PlugIn(self, owner) Attach to owner and register ourself and our _exported_methods in it. If defined by a subclass, call self.plugin(owner) to execute hook code after plugging | source code

PlugOut(self) Unregister our _exported_methods from owner and detach from it. If defined by a subclass, call self.plugout() after unplugging to execute hook code | source code

Class Methods | [hide private]

get_instance(cls, *args, **kwargs) Factory Method for object creation |

Method Details | [hide private]

### __init__(self)
(Constructor)

source code

### PlugIn(self, owner)

source code

Attach to owner and register ourself and our _exported_methods in it. If defined by a subclass, call self.plugin(owner) to execute hook code after plugging

### PlugOut(self)

source code

Unregister our _exported_methods from owner and detach from it. If defined by a subclass, call self.plugout() after unplugging to execute hook code

### get_instance(cls, *args, **kwargs)
Class Method

Factory Method for object creation

Use this instead of directly initializing the class in order to make unit testing easier. For testing, this method can be patched to inject mock objects.