git://git.onelab.eu
/
sface.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
set maximum width of status messages to prevent main window from getting really wide
[sface.git]
/
sface
/
xmlrpcwindow.py
diff --git
a/sface/xmlrpcwindow.py
b/sface/xmlrpcwindow.py
index
cc17584
..
81007c0
100644
(file)
--- a/
sface/xmlrpcwindow.py
+++ b/
sface/xmlrpcwindow.py
@@
-20,10
+20,17
@@
class XmlrpcReader():
self.rawOutput = rawOutput
def parseMethodResponse(self, mr):
self.rawOutput = rawOutput
def parseMethodResponse(self, mr):
- tree = etree.fromstring(str(mr))
+ mr = str(mr) # PyQT supplies a QByteArray; make it a string
response = {"kind": "unknown"}
response = {"kind": "unknown"}
+ try:
+ tree = etree.fromstring(mr)
+ except etree.XMLSyntaxError, e:
+ print "failed to parse XML response", str(e)
+ #file("badparse.xml","w").write(mr)
+ return response
+
if tree.tag != "methodResponse" or (len(list(tree))==0):
return response
if tree.tag != "methodResponse" or (len(list(tree))==0):
return response
@@
-62,7
+69,7
@@
class XmlrpcReader():
replies = re.compile(pttrnAns, re.DOTALL).findall(self.rawOutput)
# cleaning
answers = [ x.replace('\\n','\n') for x in answers ]
replies = re.compile(pttrnAns, re.DOTALL).findall(self.rawOutput)
# cleaning
answers = [ x.replace('\\n','\n') for x in answers ]
- replies = [ x.replace('\\n','\n').replace("'\nbody: '", '') for x in replies ]
+ replies = [ x.replace('\\n','\n').replace("'\nbody: '", '')
.replace("\"\nbody: '", '')
for x in replies ]
replies.reverse() # so that I use pop() as popleft
# A well-formed XML document must have one, and only one, top-level element
replies.reverse() # so that I use pop() as popleft
# A well-formed XML document must have one, and only one, top-level element