mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Updated ElementBase.enable and ElementBase.initPlugin
This commit is contained in:
parent
c20fab0f6c
commit
b580a3138d
1 changed files with 23 additions and 8 deletions
|
@ -108,6 +108,29 @@ class ElementBase(object):
|
|||
# We did not generate XML
|
||||
return False
|
||||
|
||||
def enable(self, attrib):
|
||||
"""
|
||||
Enable and initialize a stanza plugin.
|
||||
|
||||
Alias for initPlugin.
|
||||
|
||||
Arguments:
|
||||
attrib -- The stanza interface for the plugin.
|
||||
"""
|
||||
return self.initPlugin(attrib)
|
||||
|
||||
def initPlugin(self, attrib):
|
||||
"""
|
||||
Enable and initialize a stanza plugin.
|
||||
|
||||
Arguments:
|
||||
attrib -- The stanza interface for the plugin.
|
||||
"""
|
||||
if attrib not in self.plugins:
|
||||
plugin_class = self.plugin_attrib_map[attrib]
|
||||
self.plugins[attrib] = plugin_class(parent=self)
|
||||
return self
|
||||
|
||||
@property
|
||||
def attrib(self): #backwards compatibility
|
||||
return self
|
||||
|
@ -191,14 +214,6 @@ class ElementBase(object):
|
|||
def findall(self, xpath):
|
||||
return self.xml.findall(xpath)
|
||||
|
||||
def enable(self, attrib):
|
||||
self.initPlugin(attrib)
|
||||
return self
|
||||
|
||||
def initPlugin(self, attrib):
|
||||
if attrib not in self.plugins:
|
||||
self.plugins[attrib] = self.plugin_attrib_map[attrib](parent=self)
|
||||
|
||||
def __getitem__(self, attrib):
|
||||
if attrib == 'substanzas':
|
||||
return self.iterables
|
||||
|
|
Loading…
Reference in a new issue