[thorstenp] replace none equality test with identity test

This commit is contained in:
Yann Leboulanger 2008-10-11 09:44:12 +00:00
parent ed748fdda3
commit 73aee40542
7 changed files with 11 additions and 11 deletions

View File

@ -1204,7 +1204,7 @@ class Connection(ConnectionHandlers):
ji = gajim.get_jid_without_resource(jid)
if gajim.config.should_log(self.name, ji):
log_msg = msg
if original_message != None:
if original_message is not None:
log_msg = original_message
if subject:
log_msg = _('Subject: %(subject)s\n%(message)s') % \

View File

@ -893,7 +893,7 @@ class Socks5Receiver(Socks5, IdleObject):
def connect(self):
''' create the socket and plug it to the idlequeue '''
if self.ais == None:
if self.ais is None:
return None
for ai in self.ais:

View File

@ -197,14 +197,14 @@ class Browser(PlugIn):
# handler must return list: [{jid,action,node,name}]
if type(handler)==dict: lst=handler['items']
else: lst=handler(conn,request,'items')
if lst==None:
if lst is None:
conn.send(Error(request,ERR_ITEM_NOT_FOUND))
raise NodeProcessed
for item in lst: q.addChild('item',item)
elif request.getQueryNS()==NS_DISCO_INFO:
if type(handler)==dict: dt=handler['info']
else: dt=handler(conn,request,'info')
if dt==None:
if dt is None:
conn.send(Error(request,ERR_ITEM_NOT_FOUND))
raise NodeProcessed
# handler must return dictionary:

View File

@ -93,7 +93,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
self.dispatch('ERROR', (_('Wrong host'), _('The host %s you configured as the ft_add_hosts_to_send advanced option is not valid, so ignored.') % ft_host))
listener = gajim.socks5queue.start_listener(port,
sha_str, self._result_socks5_sid, file_props['sid'])
if listener == None:
if listener is None:
file_props['error'] = -5
self.dispatch('FILE_REQUEST_ERROR', (unicode(receiver), file_props,
''))
@ -263,7 +263,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream):
if proxyhost['jid'] == jid:
proxy = proxyhost
if proxy != None:
if proxy is not None:
file_props['streamhost-used'] = True
if 'streamhosts' not in file_props:
file_props['streamhosts'] = []
@ -397,7 +397,7 @@ class ConnectionHandlersZeroconf(ConnectionVcard, ConnectionBytestream, connecti
if not mtype:
mtype = 'normal'
if frm == None:
if frm is None:
for key in self.connection.zeroconf.contacts:
if ip == self.connection.zeroconf.contacts[key][zeroconf.C_ADDRESS]:
frm = key

View File

@ -457,7 +457,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
reason += ' ' + _('Your message could not be sent.')
self.dispatch('MSGERROR', [jid, '-1', reason, None, None, session])
ret = self.connection.send(msg_iq, msg != None, on_ok=on_send_ok,
ret = self.connection.send(msg_iq, msg is not None, on_ok=on_send_ok,
on_not_ok=on_send_not_ok)
if ret == -1:
# Contact Offline

View File

@ -62,7 +62,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
chatstate = None
# chatstates - look for chatstate tags in a message if not delayed
delayed = msg.getTag('x', namespace=common.xmpp.NS_DELAY) != None
delayed = msg.getTag('x', namespace=common.xmpp.NS_DELAY) is not None
if not delayed:
composing_xep = False
children = msg.getChildren()

View File

@ -116,7 +116,7 @@ class Mock:
raise a MockInterfaceError.
Based on the Python 2.3.3 Reference Manual section 5.3.4: Calls.
"""
if self.realClassMethods == None:
if self.realClassMethods is None:
return
if name not in self.realClassMethods:
raise MockInterfaceError("Calling mock method '%s' that was not found in the original class" % name)
@ -411,7 +411,7 @@ def NOT(cond):
def MATCHES(regex, *args, **kwargs):
compiled_regex = re.compile(regex, *args, **kwargs)
def testFn(param):
return compiled_regex.match(param) != None
return compiled_regex.match(param) is not None
return testFn
def SEQ(*sequence):