Changeset 3253
- Timestamp:
- 07/14/07 04:42:09 (1 year ago)
- Files:
-
- trunk/dabo/dException.py (modified) (1 diff)
- trunk/dabo/lib/xmltodict.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/dException.py
r3054 r3253 67 67 return self.err_desc + '\nSQL: ' + self.sql 68 68 69 class XmlException(dException): 70 pass trunk/dabo/lib/xmltodict.py
r3054 r3253 13 13 import dabo 14 14 import dabo.lib.DesignerUtils as desUtil 15 from dabo.dLocalize import _ 15 16 from dabo.lib.utils import resolvePath 16 17 app = dabo.dAppRef … … 166 167 parser.attsToSkip = attsToSkip 167 168 isPath = os.path.exists(xml) 169 errmsg = "" 168 170 if eol not in xml and isPath: 169 171 # argument was a file 170 ret = parser.ParseFromFile(xml) 172 try: 173 ret = parser.ParseFromFile(xml) 174 except expat.ExpatError, e: 175 errmsg = _("The XML in '%s' is not well-formed and cannot be parsed: %s") % (xml, e) 171 176 else: 172 177 # argument must have been raw xml: 173 ret = parser.Parse(xml) 178 if not xml.strip().startswith("<?xml "): 179 # it's a bad file name 180 errmsg = _("The file '%s' could not be found") % xml 181 else: 182 try: 183 ret = parser.Parse(xml) 184 except expat.ExpatError: 185 errmsg = _("An invalid XML string was encountered") 186 if errmsg: 187 raise dabo.dException.XmlException, errmsg 174 188 if addCodeFile and isPath: 175 189 # Get the associated code file, if any
