dabo Commit
Revision 2354
Date: 2006-10-15 15:08:09 -0700 (Sun, 15 Oct 2006)
Author: ed

Changed:
U   trunk/dabo/lib/DesignerXmlConverter.py

Log:
Fixed a problem when creating objects from raw XML code rather than reading in 
from a file. The converter was trying to treat the XML itself as a file name 
for determining the associated code file, which of course there isn't any, 
since the XML isn't a file reference.


Diff:
Modified: trunk/dabo/lib/DesignerXmlConverter.py
===================================================================
--- trunk/dabo/lib/DesignerXmlConverter.py      2006-10-15 20:13:33 UTC (rev 
2353)
+++ trunk/dabo/lib/DesignerXmlConverter.py      2006-10-15 22:08:09 UTC (rev 
2354)
@@ -70,6 +70,7 @@
                file path, an open file object, or the raw XML. It will look for
                a matching code file and, if found, import that code.
                """
+               parseCode = True
                if isinstance(src, file):
                        xml = src.read()
                        self._srcFile = src.name
@@ -79,15 +80,17 @@
                                self._srcFile = src
                        else:
                                xml = src
+                               parseCode = False
                                self._srcFile = os.getcwd()
                dct = xtd.xmltodict(xml)
 
-               codePth = "%s-code.py" % os.path.splitext(src)[0]
-               try:
-                       codeDict = desUtil.parseCodeFile(open(codePth).read())
-                       desUtil.addCodeToClassDict(dct, codeDict)
-               except StandardError, e:
-                       print "Failed to parse code file:", e
+               if parseCode:
+                       codePth = "%s-code.py" % os.path.splitext(src)[0]
+                       try:
+                               codeDict = 
desUtil.parseCodeFile(open(codePth).read())
+                               desUtil.addCodeToClassDict(dct, codeDict)
+                       except StandardError, e:
+                               print "Failed to parse code file:", e
                return dct
 
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to