[MOBY-guts] biomoby commit
Yan Wong
yanwong at pub.open-bio.org
Tue Apr 5 15:59:47 UTC 2005
yanwong
Tue Apr 5 11:59:47 EDT 2005
Update of /home/repository/moby/moby-live/Python/utils
In directory pub.open-bio.org:/tmp/cvs-serv24223
Modified Files:
moby2python.py
Log Message:
The scripts generate correctly the marshall and unmarshall code of autogenerated objects
moby-live/Python/utils moby2python.py,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Python/utils/moby2python.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Python/utils/moby2python.py 2005/02/07 14:23:13 1.6
+++ /home/repository/moby/moby-live/Python/utils/moby2python.py 2005/04/05 15:59:47 1.7
@@ -54,7 +54,7 @@
res.append(" \"\"\" Load the attributes from an XML string\n \"\"\"")
res.append(" from bioMoby.mobyMarshal import MobyUnmarshaller")
res.append(" doc=value")
- res.append(" if isinstance(value, str):")
+ res.append(" if isinstance(value,str):")
res.append(" doc=parseString(value).firstChild")
res.append(" um=MobyUnmarshaller()")
res.append(" self.content=\"\"")
@@ -85,13 +85,11 @@
res.append(" if elt.nodeName==\"CrossReference\" or elt.nodeName==\"moby:CrossReference\":")
res.append(" self.__cross__=[]")
res.append(" for ref in elt.childNodes:")
- res.append(" if ref.nodeType==ref.ELEMENT_NODE:")
- res.append(" self.__cross__.append(um.loadn(ref))")
-
+ res.append(" self.__cross__.append(ref)")
for parameter in parameters:
if parameter[0] not in attributes and parameter[0]!="content":
- res.append(" if elt.nodeType==elt.ELEMENT_NODE and (elt.nodeName==\""+parameter[2]+"\" or elt.nodeName==\"moby:"+parameter[2]+"\") and (elt.getAttribute(\"articleName\")==\""+parameter[0]+"\" or elt.getAttribute(\"moby:articleName\")==\""+parameter[0]+"\"):")
+ res.append(" if elt.nodeType==elt.ELEMENT_NODE and (elt.nodeName==\""+parameter[2]+"\" or elt.nodeName==\"moby:"+parameter[2]+"\") and (elt.getAttribute(\"articleName\")==\""+cleanName(parameter[0])+"\" or elt.getAttribute(\"moby:articleName\")==\""+cleanName(parameter[0])+"\"):")
if parameter[2]=='Integer' or parameter[2]=='Float' or parameter[2]=='String':
res.append(" t="+makeMobyName(parameter[2])+"()")
@@ -102,9 +100,14 @@
res.append(" self."+cleanName(parameter[0])+".append(t.content)")
elif parameter[0]!='content':
- res.append(" self."+cleanName(parameter[0])+"="+makeMobyName(parameter[2])+"()")
- res.append(" self."+cleanName(parameter[0])+".fromMoby(elt)")
-
+ if parameter[1]!="[]":
+ res.append(" self."+cleanName(parameter[0])+"="+makeMobyName(parameter[2])+"()")
+ res.append(" self."+cleanName(parameter[0])+".fromMoby(elt)")
+ else:
+ res.append(" auxObject="+makeMobyName(parameter[2])+"()")
+ res.append(" auxObject.fromMoby(elt)")
+ res.append(" self."+cleanName(parameter[0])+".append(auxObject)")
+
return "\n".join(res)
def getPropertiesFromAncestor(ancestor):
@@ -136,7 +139,7 @@
if ancestor not in paramDict.keys():
makeInterface(ancestor, path)
-
+
for aProp in getPropertiesFromAncestor(ancestor):
properties.append(aProp)
@@ -153,7 +156,7 @@
properties.append((articleName,"None",articleType))
-
+
if "HAS" in objectDefinition["Relationship"].keys():
for hasRelationship in objectDefinition["Relationship"]["HAS"]:
articleName=hasRelationship[0]
@@ -200,9 +203,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"]
@@ -293,6 +296,7 @@
toRead.append(f)
try:
toRead.remove("__init__.py")
+ toRead.remove("CVS")
except:
pass
More information about the MOBY-guts
mailing list