[Buildbot-commits] buildbot/buildbot/changes bonsaipoller.py, 1.4, 1.5
Brian Warner
warner at users.sourceforge.net
Wed Jan 31 00:46:00 UTC 2007
Update of /cvsroot/buildbot/buildbot/buildbot/changes
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26939/buildbot/changes
Modified Files:
bonsaipoller.py
Log Message:
[project @ BonsaiPoller: handle non-ascii characters. Patch from Ben Hearsum, closes SF#1632641]
Original author: warner at lothar.com
Date: 2007-01-31 00:43:15
Index: bonsaipoller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/bonsaipoller.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- bonsaipoller.py 12 Dec 2006 03:24:03 -0000 1.4
+++ bonsaipoller.py 31 Jan 2007 00:45:58 -0000 1.5
@@ -66,7 +66,16 @@
def __init__(self, bonsaiQuery):
try:
- self.dom = minidom.parse(bonsaiQuery)
+ # this is a fix for non-ascii characters
+ # readlines() + join is being used because read() is not guaranteed
+ # to work. because bonsai does not give us an encoding to work with
+ # it impossible to be 100% sure what to decode it as but latin1 covers
+ # the broadest base
+ data = "".join(bonsaiQuery.readlines())
+ data = data.decode("latin1")
+ data = data.encode("ascii", "replace")
+ self.dom = minidom.parseString(data)
+ log.msg(data)
except:
raise InvalidResultError("Malformed XML in result")
More information about the Commits
mailing list