Use log.warning instead of the deprecated log.warn.

This commit is contained in:
Emmanuel Gil Peyrot 2013-01-05 11:26:22 +01:00
parent ec6e9667fa
commit ab7ce2b42e
10 changed files with 20 additions and 20 deletions

View File

@ -173,7 +173,7 @@ try:
return True
return False
except ImportError:
log.warn('Import of PyOpenSSL or pyasn1 failed. Cannot correctly check '
log.warning('Import of PyOpenSSL or pyasn1 failed. Cannot correctly check '
'SSL certificate')
def check_certificate(cert, domain):

View File

@ -381,7 +381,7 @@ class ConnectionCommands:
try:
jid = helpers.get_full_jid_from_iq(iq_obj)
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % iq_obj.getFrom())
log.warning('Invalid JID: %s, ignoring it' % iq_obj.getFrom())
return
node = iq_obj.getTagAttr('query', 'node')

View File

@ -2678,7 +2678,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if self.awaiting_xmpp_ping_id:
# We haven't got the pong in time, disco and reconnect
log.warn("No reply received for keepalive ping. Reconnecting.")
log.warning("No reply received for keepalive ping. Reconnecting.")
self._disconnectedReconnCB()
def _reconnect_alarm(self):

View File

@ -306,7 +306,7 @@ class RosterItemExchangeEvent(nec.NetworkIncomingEvent, HelperEvent):
try:
jid = helpers.parse_jid(item.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % item.getAttr('jid'))
log.warning('Invalid JID: %s, ignoring it' % item.getAttr('jid'))
continue
name = item.getAttr('name')
contact = gajim.contacts.get_contact(self.conn.name, jid)
@ -399,7 +399,7 @@ class RosterSetReceivedEvent(nec.NetworkIncomingEvent):
try:
jid = helpers.parse_jid(item.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % item.getAttr('jid'))
log.warning('Invalid JID: %s, ignoring it' % item.getAttr('jid'))
continue
name = item.getAttr('name')
sub = item.getAttr('subscription')
@ -447,7 +447,7 @@ class MucAdminReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
try:
jid = helpers.parse_jid(item.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % \
log.warning('Invalid JID: %s, ignoring it' % \
item.getAttr('jid'))
continue
affiliation = item.getAttr('affiliation')
@ -489,7 +489,7 @@ class BookmarksHelper:
try:
jid = helpers.parse_jid(conf.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % conf.getAttr('jid'))
log.warning('Invalid JID: %s, ignoring it' % conf.getAttr('jid'))
continue
bm = {'name': conf.getAttr('name'),
'jid': jid,
@ -541,7 +541,7 @@ class PrivateStorageRosternotesReceivedEvent(nec.NetworkIncomingEvent):
try:
jid = helpers.parse_jid(note.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % note.getAttr('jid'))
log.warning('Invalid JID: %s, ignoring it' % note.getAttr('jid'))
continue
annotation = note.getData()
self.annotations[jid] = annotation
@ -755,7 +755,7 @@ PresenceHelperEvent):
try:
self.get_jid_resource()
except Exception:
log.warn('Invalid JID: %s, ignoring it' % self.stanza.getFrom())
log.warning('Invalid JID: %s, ignoring it' % self.stanza.getFrom())
return
jid_list = gajim.contacts.get_jid_list(self.conn.name)
self.timestamp = None
@ -1036,7 +1036,7 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
try:
self.fjid = helpers.parse_jid(address.getAttr('jid'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % address.getAttr(
log.warning('Invalid JID: %s, ignoring it' % address.getAttr(
'jid'))
return
self.jid = gajim.get_jid_without_resource(self.fjid)
@ -1186,7 +1186,7 @@ class GcInvitationReceivedEvent(nec.NetworkIncomingEvent):
try:
self.jid_from = helpers.parse_jid(item.getAttr('from'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % item.getAttr('from'))
log.warning('Invalid JID: %s, ignoring it' % item.getAttr('from'))
return
jid = gajim.get_jid_without_resource(self.jid_from)
if gajim.config.get_per('accounts', self.conn.name,
@ -1213,7 +1213,7 @@ class GcDeclineReceivedEvent(nec.NetworkIncomingEvent):
try:
self.jid_from = helpers.parse_jid(item.getAttr('from'))
except helpers.InvalidFormat:
log.warn('Invalid JID: %s, ignoring it' % item.getAttr('from'))
log.warning('Invalid JID: %s, ignoring it' % item.getAttr('from'))
return
jid = gajim.get_jid_without_resource(self.jid_from)
if gajim.config.get_per('accounts', self.conn.name,
@ -1919,7 +1919,7 @@ class AgentInfoReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
def generate(self):
self.get_id()
if self.id_ is None:
log.warn('Invalid IQ received without an ID. Ignoring it: %s' % \
log.warning('Invalid IQ received without an ID. Ignoring it: %s' % \
self.stanza)
return
# According to XEP-0030:

View File

@ -80,7 +80,7 @@ class GlobalEventsDispatcher(object):
try:
self.handlers[event_name].remove((priority, handler))
except ValueError:
log.warn('''Function (%s) with priority "%s" never registered
log.warning('''Function (%s) with priority "%s" never registered
as handler of event "%s". Couldn\'t remove. Error: %s'''
%(handler, priority, event_name, error))

View File

@ -88,7 +88,7 @@ class JingleRTPContent(JingleContent):
ip = socket.getaddrinfo(stun_server, 0, socket.AF_UNSPEC,
socket.SOCK_STREAM)[0][4][0]
except socket.gaierror as e:
log.warn('Lookup of stun ip failed: %s' % str(e))
log.warning('Lookup of stun ip failed: %s' % str(e))
else:
params['stun-ip'] = ip

View File

@ -177,13 +177,13 @@ if __name__ == '__main__':
log = logging.getLogger('gajim')
log.debug('debug')
log.info('info')
log.warn('warn')
log.warning('warn')
log.error('error')
log.critical('critical')
log = logging.getLogger('gajim.c.x.dispatcher')
log.debug('debug')
log.info('info')
log.warn('warn')
log.warning('warn')
log.error('error')
log.critical('critical')

View File

@ -645,7 +645,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
self.send_success_connect_reply, None)
raise nbxmpp.NodeProcessed
else:
log.warn('Gajim got streamhosts for unknown transfer. Ignoring it.')
log.warning('Gajim got streamhosts for unknown transfer. Ignoring it.')
raise nbxmpp.NodeProcessed
file_props.streamhosts = streamhosts

View File

@ -449,7 +449,7 @@ class Interface:
if not obj.session:
# No session. This can happen when sending a message from
# gajim-remote
log.warn(msg)
log.warning(msg)
return
obj.session.roster_message(obj.jid, msg, obj.time_, obj.conn.name,
msg_type='error')

View File

@ -264,7 +264,7 @@ class GajimPluginConfig():
s.close()
self.save()
except:
log.warn('%s plugin config file not readable. Saving it as '
log.warning('%s plugin config file not readable. Saving it as '
'%s and creating a new one' % (self.plugin.short_name,
self.FILE_PATH + '.bak'))
if os.path.exists(self.FILE_PATH + '.bak'):