Some Python 3.1+ compatibility fixes.

Originally contributed by filipegiusti.
This commit is contained in:
Lance Stout 2010-12-16 15:29:17 -05:00
parent d9c25ee65c
commit e81683beee
2 changed files with 2 additions and 4 deletions

View file

@ -1,7 +1,6 @@
from . import base from . import base
import logging import logging
from xml.etree import cElementTree as ET from xml.etree import cElementTree as ET
import types
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -43,7 +42,7 @@ class jobs(base.base_plugin):
iq['psstate']['item'] = jobid iq['psstate']['item'] = jobid
iq['psstate']['payload'] = state iq['psstate']['payload'] = state
result = iq.send() result = iq.send()
if result is None or type(result) == types.BooleanType or result['type'] != 'result': if result is None or type(result) == bool or result['type'] != 'result':
log.error("Unable to change %s:%s to %s" % (node, jobid, state)) log.error("Unable to change %s:%s to %s" % (node, jobid, state))
return False return False
return True return True

View file

@ -13,7 +13,6 @@ from .. xmlstream.handler.callback import Callback
from .. xmlstream.matcher.xpath import MatchXPath from .. xmlstream.matcher.xpath import MatchXPath
from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
from .. stanza.message import Message from .. stanza.message import Message
import types
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -203,7 +202,7 @@ class Form(ElementBase):
def merge(self, other): def merge(self, other):
new = copy.copy(self) new = copy.copy(self)
if type(other) == types.DictType: if type(other) == dict:
new.setValues(other) new.setValues(other)
return new return new
nfields = new.getFields(use_dict=True) nfields = new.getFields(use_dict=True)