summaryrefslogtreecommitdiff
path: root/examples/custom_stanzas
diff options
context:
space:
mode:
authorPaul Molodowitch <elrond79@gmail.com>2012-10-24 11:27:52 -0700
committerLance Stout <lancestout@gmail.com>2012-10-24 13:06:36 -0700
commit52feabbe7641f19a17810438d2469b2395b2819f (patch)
treea54ad92b80775233aafc05acdf27adf3942973df /examples/custom_stanzas
parenta22ca228cc3a121da8bad4268c39bff5190db969 (diff)
downloadslixmpp-52feabbe7641f19a17810438d2469b2395b2819f.tar.gz
slixmpp-52feabbe7641f19a17810438d2469b2395b2819f.tar.bz2
slixmpp-52feabbe7641f19a17810438d2469b2395b2819f.tar.xz
slixmpp-52feabbe7641f19a17810438d2469b2395b2819f.zip
added setdefaultencoding method so reload(sys) not needed
reload(sys) could cause problem in user code - ie, sys.stdout, excepthook, and displayhook would be reset, etc
Diffstat (limited to 'examples/custom_stanzas')
-rwxr-xr-xexamples/custom_stanzas/custom_stanza_provider.py8
-rwxr-xr-xexamples/custom_stanzas/custom_stanza_user.py4
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/custom_stanzas/custom_stanza_provider.py b/examples/custom_stanzas/custom_stanza_provider.py
index b532c17c..b0e00247 100755
--- a/examples/custom_stanzas/custom_stanza_provider.py
+++ b/examples/custom_stanzas/custom_stanza_provider.py
@@ -28,8 +28,8 @@ from stanza import Action
# throughout SleekXMPP, we will set the default encoding
# ourselves to UTF-8.
if sys.version_info < (3, 0):
- reload(sys)
- sys.setdefaultencoding('utf8')
+ from sleekxmpp.util.misc_ops import setdefaultencoding
+ setdefaultencoding('utf8')
else:
raw_input = input
@@ -56,8 +56,8 @@ class ActionBot(sleekxmpp.ClientXMPP):
StanzaPath('iq@type=set/action'),
self._handle_action))
- self.add_event_handler('custom_action',
- self._handle_action_event,
+ self.add_event_handler('custom_action',
+ self._handle_action_event,
threaded=True)
register_stanza_plugin(Iq, Action)
diff --git a/examples/custom_stanzas/custom_stanza_user.py b/examples/custom_stanzas/custom_stanza_user.py
index 5b5042c7..418e3218 100755
--- a/examples/custom_stanzas/custom_stanza_user.py
+++ b/examples/custom_stanzas/custom_stanza_user.py
@@ -26,8 +26,8 @@ from stanza import Action
# throughout SleekXMPP, we will set the default encoding
# ourselves to UTF-8.
if sys.version_info < (3, 0):
- reload(sys)
- sys.setdefaultencoding('utf8')
+ from sleekxmpp.util.misc_ops import setdefaultencoding
+ setdefaultencoding('utf8')
else:
raw_input = input