[MOBY-guts] biomoby commit

Yan Wong yanwong at pub.open-bio.org
Tue Jan 18 13:44:04 UTC 2005


yanwong
Tue Jan 18 08:44:04 EST 2005
Update of /home/repository/moby/moby-live/Python/utils
In directory pub.open-bio.org:/tmp/cvs-serv20751

Modified Files:
	moby2python.py 
Log Message:


moby-live/Python/utils moby2python.py,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Python/utils/moby2python.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Python/utils/moby2python.py	2004/12/09 14:38:10	1.3
+++ /home/repository/moby/moby-live/Python/utils/moby2python.py	2005/01/18 13:44:04	1.4
@@ -52,7 +52,6 @@
 
     res=["    def fromMoby(self, value):\n"]
     res.append("        \"\"\" Load the attributes from an XML string\n        \"\"\"")
-    res.append("        from xml.dom.minidom import parseString, Node, NodeList")
     res.append("        from bioMoby.mobyMarshal import MobyUnmarshaller")
     res.append("        doc=parseString(value).firstChild")
     res.append("        um=MobyUnmarshaller()")
@@ -69,9 +68,9 @@
             res.append("        if self."+att+"==\"\":")
             res.append("            self."+att+"=doc.getAttribute(\""+att+"\")")
             
-    res.append("\n        self._articleName=doc.getAttribute(\"moby:articleName\")")
-    res.append("        if self._articleName==\"\":\n")
-    res.append("            self._articleName=doc.getAttribute(\"articleName\")")
+    res.append("\n        self.articleName=doc.getAttribute(\"moby:articleName\")")
+    res.append("        if self.articleName==\"\":\n")
+    res.append("            self.articleName=doc.getAttribute(\"articleName\")")
     
 
     for par in parameters:
@@ -82,9 +81,9 @@
     res.append("            if elt.nodeType==elt.TEXT_NODE or elt.nodeType==elt.CDATA_SECTION_NODE:")
     res.append("                self.content=self.content+elt.nodeValue")
     res.append("            if elt.nodeName==\"CrossReference\" or elt.nodeName==\"moby:CrossReference\":")
-    res.append("                self._cross=[]")
+    res.append("                self.__cross__=[]")
     res.append("                for ref in elt.childNodes:")
-    res.append("                    self._cross.append(ref.toxml())")        
+    res.append("                    self.__cross__.append(ref.toxml())")        
 
 
     for parameter in parameters:
@@ -103,8 +102,6 @@
                 res.append("                self."+cleanName(parameter[0])+"="+makeMobyName(parameter[2])+"()")
                 res.append("                self."+cleanName(parameter[0])+".fromMoby(elt.toxml())")
                     
-    res.append("        del parseString, Node, NodeList")
-
     return "\n".join(res)
 
 def getPropertiesFromAncestor(ancestor):
@@ -175,6 +172,8 @@
     paramDict[objectName]=properties
 
     pyResult=["#Autogenerated class\n"]
+    
+    pyResult.append("\n\nfrom xml.dom.minidom import parseString\n\n")
 
     already=[]
 
@@ -238,9 +237,9 @@
     for property in properties:
         pyResult.append("        self."+cleanName(property[0])+"="+cleanName(property[0])+"\n")
         
-    pyResult.append("        self._tag=\""+objectName+"\"\n")
-    pyResult.append("        self._articleName=articleName\n")
-    pyResult.append("        self._cross=None\n")
+    pyResult.append("        self.__prefix__=\"moby\"\n")
+    pyResult.append("        self.__tag__=\""+objectName+"\"\n")
+    pyResult.append("        self.articleName=articleName\n")
     pyResult.append("\n\n")
 
     pyResult.append(makeFromMoby(paramDict[objectName]))




More information about the MOBY-guts mailing list