[PATCH] zeroconf: use util.Abort() instead of deprecated string exceptions

Javi Merino cibervicho at gmail.com
Fri Jun 11 06:22:46 CDT 2010


Hi, string exceptions no longer work in python 2.6 [0]. This patch
fixes the zeroconf module, which still used them.

[0] http://docs.python.org/whatsnew/2.6.html#deprecations-and-removals

Regards,
Javi (Vicho)

# HG changeset patch
# User Javi Merino <cibervicho at gmail.com>
# Date 1276255042 -7200
# Node ID a5be2a7ddc75b9ba3838d676ae5feb6cbfd1beb4
# Parent  5bf46516063236efd8a2646643dba9ad3487a109
zeroconf: use util.Abort() instead of deprecated string exceptions

String exceptions no longer work in python 2.6. This changeset makes
zeroconf use the util.Abort() exception instead.

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -78,6 +78,8 @@ __author__ = "Paul Scott-Murphy"
 __email__ = "paul at scott dash murphy dot com"
 __version__ = "0.12"
 
+from mercurial.i18n import _
+from mercurial import util
 import string
 import time
 import struct
@@ -598,10 +600,10 @@ class DNSIncoming(object):
                                        next = off + 1
                                off = ((len & 0x3F) << 8) | ord(self.data[off])
                                if off >= first:
-                                       raise "Bad domain name (circular) at " + str(off)
+                                       raise util.Abort(_("Bad domain name (circular) at " + str(off)))
                                first = off
                        else:
-                               raise "Bad domain name at " + str(off)
+                               raise util.Abort(_("Bad domain name at " + str(off)))
 
                if next >= 0:
                        self.offset = next

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100611/623c8901/attachment.pgp>


More information about the Mercurial-devel mailing list