From ab7ce2b42eef0c8ee5da032135ea367f7987a977 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 5 Jan 2013 11:26:22 +0100 Subject: [PATCH] Use log.warning instead of the deprecated log.warn. --- src/common/check_X509.py | 2 +- src/common/commands.py | 2 +- src/common/connection.py | 2 +- src/common/connection_handlers_events.py | 20 ++++++++++---------- src/common/ged.py | 2 +- src/common/jingle_rtp.py | 2 +- src/common/logging_helpers.py | 4 ++-- src/common/protocol/bytestream.py | 2 +- src/gui_interface.py | 2 +- src/plugins/plugin.py | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/common/check_X509.py b/src/common/check_X509.py index 5d7213dcb..d26a96527 100644 --- a/src/common/check_X509.py +++ b/src/common/check_X509.py @@ -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): diff --git a/src/common/commands.py b/src/common/commands.py index aaf6c8536..0de313be7 100644 --- a/src/common/commands.py +++ b/src/common/commands.py @@ -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') diff --git a/src/common/connection.py b/src/common/connection.py index 2d802af06..d77df470e 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -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): diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py index 412e31e73..0ae9a084e 100644 --- a/src/common/connection_handlers_events.py +++ b/src/common/connection_handlers_events.py @@ -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: diff --git a/src/common/ged.py b/src/common/ged.py index 79b5b3e95..41edd012e 100644 --- a/src/common/ged.py +++ b/src/common/ged.py @@ -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)) diff --git a/src/common/jingle_rtp.py b/src/common/jingle_rtp.py index 497f7e216..8ab92d10f 100644 --- a/src/common/jingle_rtp.py +++ b/src/common/jingle_rtp.py @@ -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 diff --git a/src/common/logging_helpers.py b/src/common/logging_helpers.py index 22bc7ab73..722310fd8 100644 --- a/src/common/logging_helpers.py +++ b/src/common/logging_helpers.py @@ -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') diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py index 4077dbe18..7a48c1c65 100644 --- a/src/common/protocol/bytestream.py +++ b/src/common/protocol/bytestream.py @@ -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 diff --git a/src/gui_interface.py b/src/gui_interface.py index e2c46f137..7ffbb2d3e 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -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') diff --git a/src/plugins/plugin.py b/src/plugins/plugin.py index b3a54a1cf..0a7a8648f 100644 --- a/src/plugins/plugin.py +++ b/src/plugins/plugin.py @@ -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'):