From e28728278246b2f73e86969cfdb881d9ef17a51e Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Sun, 11 Mar 2012 18:40:30 -0700 Subject: [PATCH] Moving backwards compatibility shims to __init__ files. --- sleekxmpp/plugins/xep_0030/__init__.py | 13 ++++++++++++- sleekxmpp/plugins/xep_0030/disco.py | 11 +---------- sleekxmpp/plugins/xep_0059/__init__.py | 10 +++++++++- sleekxmpp/plugins/xep_0059/rsm.py | 5 ----- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/sleekxmpp/plugins/xep_0030/__init__.py b/sleekxmpp/plugins/xep_0030/__init__.py index 2e183852..0d1de65b 100644 --- a/sleekxmpp/plugins/xep_0030/__init__.py +++ b/sleekxmpp/plugins/xep_0030/__init__.py @@ -6,7 +6,18 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin + from sleekxmpp.plugins.xep_0030 import stanza from sleekxmpp.plugins.xep_0030.stanza import DiscoInfo, DiscoItems from sleekxmpp.plugins.xep_0030.static import StaticDisco -from sleekxmpp.plugins.xep_0030.disco import xep_0030 +from sleekxmpp.plugins.xep_0030.disco import XEP_0030 + + +register_plugin(XEP_0030) + +# Retain some backwards compatibility +xep_0030 = XEP_0030 +XEP_0030.getInfo = XEP_0030.get_info +XEP_0030.getItems = XEP_0030.get_items +XEP_0030.make_static = XEP_0030.restore_defaults diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py index d1f306c9..8171bd01 100644 --- a/sleekxmpp/plugins/xep_0030/disco.py +++ b/sleekxmpp/plugins/xep_0030/disco.py @@ -11,7 +11,7 @@ import logging import sleekxmpp from sleekxmpp import Iq from sleekxmpp.exceptions import XMPPError, IqError, IqTimeout -from sleekxmpp.plugins import BasePlugin, register_plugin +from sleekxmpp.plugins import BasePlugin from sleekxmpp.xmlstream.handler import Callback from sleekxmpp.xmlstream.matcher import StanzaPath from sleekxmpp.xmlstream import register_stanza_plugin, ElementBase, ET, JID @@ -787,12 +787,3 @@ class XEP_0030(BasePlugin): iq.append(payload) return iq return payload - - -register_plugin(XEP_0030) - -# Retain some backwards compatibility -xep_0030 = XEP_0030 -XEP_0030.getInfo = XEP_0030.get_info -XEP_0030.getItems = XEP_0030.get_items -XEP_0030.make_static = XEP_0030.restore_defaults diff --git a/sleekxmpp/plugins/xep_0059/__init__.py b/sleekxmpp/plugins/xep_0059/__init__.py index 3a9b8edf..3464ce32 100644 --- a/sleekxmpp/plugins/xep_0059/__init__.py +++ b/sleekxmpp/plugins/xep_0059/__init__.py @@ -6,5 +6,13 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin + from sleekxmpp.plugins.xep_0059.stanza import Set -from sleekxmpp.plugins.xep_0059.rsm import ResultIterator, xep_0059 +from sleekxmpp.plugins.xep_0059.rsm import ResultIterator, XEP_0059 + + +register_plugin(XEP_0059) + +# Retain some backwards compatibility +xep_0059 = XEP_0059 diff --git a/sleekxmpp/plugins/xep_0059/rsm.py b/sleekxmpp/plugins/xep_0059/rsm.py index a28bc7ee..9335ed22 100644 --- a/sleekxmpp/plugins/xep_0059/rsm.py +++ b/sleekxmpp/plugins/xep_0059/rsm.py @@ -129,8 +129,3 @@ class XEP_0059(BasePlugin): the interface 'disco_items' should be used. """ return ResultIterator(stanza, interface) - - -register_plugin(XEP_0059) - -xep_0059 = XEP_0059