[MOBY-guts] biomoby commit
Yan Wong
yanwong at pub.open-bio.org
Tue Feb 1 14:20:46 UTC 2005
yanwong
Tue Feb 1 09:20:46 EST 2005
Update of /home/repository/moby/moby-live/Python/utils
In directory pub.open-bio.org:/tmp/cvs-serv14364/utils
Modified Files:
moby2python.py
Log Message:
moby-live/Python/utils moby2python.py,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Python/utils/moby2python.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Python/utils/moby2python.py 2005/01/18 13:44:04 1.4
+++ /home/repository/moby/moby-live/Python/utils/moby2python.py 2005/02/01 14:20:46 1.5
@@ -53,7 +53,9 @@
res=[" def fromMoby(self, value):\n"]
res.append(" \"\"\" Load the attributes from an XML string\n \"\"\"")
res.append(" from bioMoby.mobyMarshal import MobyUnmarshaller")
- res.append(" doc=parseString(value).firstChild")
+ res.append(" doc=value")
+ res.append(" if isinstance(value, str):")
+ res.append(" doc=parseString(value).firstChild")
res.append(" um=MobyUnmarshaller()")
res.append(" self.content=\"\"")
@@ -83,7 +85,7 @@
res.append(" if elt.nodeName==\"CrossReference\" or elt.nodeName==\"moby:CrossReference\":")
res.append(" self.__cross__=[]")
res.append(" for ref in elt.childNodes:")
- res.append(" self.__cross__.append(ref.toxml())")
+ res.append(" self.__cross__.append(um.loads(ref))")
for parameter in parameters:
@@ -92,7 +94,7 @@
if parameter[2]=='Integer' or parameter[2]=='Float' or parameter[2]=='String':
res.append(" t="+makeMobyName(parameter[2])+"()")
- res.append(" t.fromMoby(elt.toxml())")
+ res.append(" t.fromMoby(elt)")
if parameter[1]!="[]":
res.append(" self."+cleanName(parameter[0])+"=t.content")
else:
@@ -100,7 +102,7 @@
elif parameter[0]!='content':
res.append(" self."+cleanName(parameter[0])+"="+makeMobyName(parameter[2])+"()")
- res.append(" self."+cleanName(parameter[0])+".fromMoby(elt.toxml())")
+ res.append(" self."+cleanName(parameter[0])+".fromMoby(elt)")
return "\n".join(res)
@@ -133,7 +135,7 @@
if ancestor not in paramDict.keys():
makeInterface(ancestor, path)
-
+
for aProp in getPropertiesFromAncestor(ancestor):
properties.append(aProp)
@@ -150,7 +152,7 @@
properties.append((articleName,"None",articleType))
-
+
if "HAS" in objectDefinition["Relationship"].keys():
for hasRelationship in objectDefinition["Relationship"]["HAS"]:
articleName=hasRelationship[0]
@@ -197,9 +199,9 @@
pyResult.append("class "+mObjectName+":\n")
if "Description" in objectDefinition:
- description=objectDefinition["Description"]
+ description=objectDefinition["Description"]
if "authURI" in objectDefinition:
- author=objectDefinition["authURI"]
+ author=objectDefinition["authURI"]
if "contactEmail" in objectDefinition:
contact=objectDefinition["contactEmail"]
More information about the MOBY-guts
mailing list