[MOBY-guts] biomoby commit
Yan Wong
yanwong at pub.open-bio.org
Tue Mar 8 10:36:17 UTC 2005
yanwong
Tue Mar 8 05:36:17 EST 2005
Update of /home/repository/moby/moby-live/Python/bioMoby
In directory pub.open-bio.org:/tmp/cvs-serv31454/bioMoby
Modified Files:
mobyDataTypes.py
Log Message:
A small bug prevented the servicenotes to be retrieved from the XML
moby-live/Python/bioMoby mobyDataTypes.py,1.17,1.18
===================================================================
RCS file: /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py 2005/02/18 15:54:10 1.17
+++ /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py 2005/03/08 10:36:17 1.18
@@ -194,6 +194,7 @@
anObj=MobyObject()
anObj.fromMoby(aCross)
self.__cross__.append(anObj)
+ #deserializes the PIB
elif child.localName=="ProvisionInformation":
for aPIB in child.childNodes:
self.__PIB__.append(aPIB.toxml())
@@ -297,13 +298,14 @@
"""The class describes a Moby Content (for queries or answers)
"""
- def __init__(self, queryData={}, authority="", servicenotes=""):
+ def __init__(self, queryData={}, authority="", servicenotes="", marshall=True):
"""Optional parameters indicate the authority's URL and notes about the service
"""
self.authority=authority
self.servicenotes=servicenotes
self.queryData=queryData
+ self._marshall=marshall
def __str__(self):
"""return the XML form of the Moby Content object
@@ -337,16 +339,21 @@
result.append("<moby:Collection moby:articleName='"+queryObject[0]+"'>")
for aSimple in queryObject[1]:
- result.append('<moby:Simple>'+m.dumps(aSimple)+'</moby:Simple>')
+ if self._marshall:
+ result.append('<moby:Simple>%s</moby:Simple>'%m.dumps(aSimple))
+ else:
+ result.append('<moby:Simple>%s</moby:Simple>'%str(aSimple))
result.append("</moby:Collection>")
#If it is a parameter
elif queryObject.__class__ is Parameter:
result.append(m.dumps(queryObject))
#Or a simple object
- else:
- result.append("<moby:Simple>"+m.dumps(queryObject)+"</moby:Simple>")
-
+ else:
+ if self._marshall:
+ result.append("<moby:Simple>%s</moby:Simple>"%m.dumps(queryObject))
+ else:
+ result.append("<moby:Simple>%s</moby:Simple>"%queryObject)
result.append("</moby:mobyData>")
result.append('</moby:mobyContent></moby:MOBY>')
@@ -511,4 +518,4 @@
def __repr__(self):
"""put the xml of the Content
"""
- return self.__str__()
\ No newline at end of file
+ return self.__str__()
More information about the MOBY-guts
mailing list