dabo Commit
Revision 3640
Date: 2007-11-07 22:08:03 -0800 (Wed, 07 Nov 2007)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/3640
Changed:
U trunk/dabo/lib/xmltodict.py
Log:
Sending raw xml to xmltodict from dReportWriter wasn't working, for who knows
how long. This fixes it.
Diff:
Modified: trunk/dabo/lib/xmltodict.py
===================================================================
--- trunk/dabo/lib/xmltodict.py 2007-11-07 22:22:02 UTC (rev 3639)
+++ trunk/dabo/lib/xmltodict.py 2007-11-08 06:08:03 UTC (rev 3640)
@@ -165,7 +165,10 @@
"""Given an xml string or file, return a Python dictionary."""
parser = Xml2Obj()
parser.attsToSkip = attsToSkip
- isPath = os.path.exists(xml)
+ if eol in xml and "<?xml" in xml:
+ isPath = False
+ else:
+ isPath = os.path.exists(xml)
errmsg = ""
if eol not in xml and isPath:
# argument was a file
@@ -175,14 +178,10 @@
errmsg = _("The XML in '%s' is not well-formed and
cannot be parsed: %s") % (xml, e)
else:
# argument must have been raw xml:
- if not xml.strip().startswith("<?xml "):
- # it's a bad file name
- errmsg = _("The file '%s' could not be found") % xml
- else:
- try:
- ret = parser.Parse(xml)
- except expat.ExpatError:
- errmsg = _("An invalid XML string was
encountered")
+ try:
+ ret = parser.Parse(xml)
+ except expat.ExpatError:
+ errmsg = _("An invalid XML string was encountered")
if errmsg:
raise dabo.dException.XmlException, errmsg
if addCodeFile and isPath:
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]