[MOBY-guts] biomoby commit

Yan Wong yanwong at pub.open-bio.org
Fri Feb 18 15:54:10 UTC 2005


yanwong
Fri Feb 18 10:54:10 EST 2005
Update of /home/repository/moby/moby-live/Python/bioMoby
In directory pub.open-bio.org:/tmp/cvs-serv26689

Modified Files:
	mobyDataTypes.py mobyMarshal.py 
Log Message:
The code has been modified in order to implement Provision Information Block
Actually, PIB is only a set of string :

  o.__PIB__=["<Remarks author= \"an Author\">this small remark will appear in the PIB</Remarks>"]

moby-live/Python/bioMoby mobyDataTypes.py,1.16,1.17 mobyMarshal.py,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py	2005/02/17 13:20:37	1.16
+++ /home/repository/moby/moby-live/Python/bioMoby/mobyDataTypes.py	2005/02/18 15:54:10	1.17
@@ -130,7 +130,9 @@
             result.append("<ProvisionInformation>")
             
             for aPIB in self.__PIB__:
-                result.append(aPIB.toMoby())
+                #Decide that a PIB will be a string where people can put its
+                #own stuff
+                result.append(str(aPIB))
                 
             result.append("</ProvisionInformation>")
         
@@ -192,6 +194,9 @@
                             anObj=MobyObject()
                             anObj.fromMoby(aCross)
                             self.__cross__.append(anObj)
+                elif child.localName=="ProvisionInformation":
+                    for aPIB in child.childNodes:
+                        self.__PIB__.append(aPIB.toxml())
                 else:
                     #Do the same for the other objects
                     associatedObjectName=child.getAttribute("moby:articleName")

===================================================================
RCS file: /home/repository/moby/moby-live/Python/bioMoby/mobyMarshal.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Python/bioMoby/mobyMarshal.py	2005/02/04 12:58:24	1.5
+++ /home/repository/moby/moby-live/Python/bioMoby/mobyMarshal.py	2005/02/18 15:54:10	1.6
@@ -280,55 +280,13 @@
         
         typeName="GMoby%s"%str(value.localName)
         
-        from bioMoby.mobyDataTypes import MobyGeneric
+        from bioMoby.mobyDataTypes import MobyObject
         
-        NewType=type(typeName, (MobyGeneric,), {})
+        NewType=type(typeName, (MobyObject,), {})
         
         anObject=NewType()
         
-        anObject.__prefix__="moby"
-        anObject.__tag__=str(value.localName)
-        
-        for tupleAttribute in value.attributes.itemsNS():
-            #First item, second field:
-            setattr(anObject, str(tupleAttribute[0][1]), str(tupleAttribute[1]))
-        
-        i=0    
-        for elem in filter(filterFunc, value.childNodes):
-            methodName="m_%s"%str(elem.localName)
-            
-            articleName=elem.getAttribute("moby:articleName")
-            
-            if not articleName:
-                articleName=elem.getAttribute("articleName")
-            
-            if not articleName:
-                articleName="attribute_%s"%i
-            
-            if hasattr(self, methodName):
-                prop=getattr(self, methodName)(elem)
-            else:
-                prop=self.m_Object(elem)
-            
-            if hasattr(anObject, articleName):
-                t=prop
-                if not type(getattr(anObject, articleName)) is list:
-                    t=getattr(anObject, articleName)
-                    setattr(anObject, articleName, [])
-                getattr(anObject, articleName).append(t)
-            else:
-                setattr(anObject, articleName, prop)
-            i+=1
-        
-        content=[]
-        
-        isContentNode= lambda x: x.nodeType==x.TEXT_NODE or x.nodeType==x.CDATA_SECTION_NODE
-        
-        for elem in filter(isContentNode, value.childNodes):
-            content.append(str(elem.nodeValue))
-        
-        if content:
-            anObject.content(r"".join(content))
+        anObject.fromMoby(value)
         
         return anObject
 




More information about the MOBY-guts mailing list