Changeset 3866 for TI02-CSML


Ignore:
Timestamp:
08/05/08 15:02:39 (11 years ago)
Author:
cbyrom
Message:

Replace [:] shorthand with explicit call to getchildren() - since
the former doesn't seem to work in some versions of elementtree.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/csml2Moles/molesReadWrite.py

    r3206 r3866  
    3232        #if this element is a parent of other elements (excluding annotation and documentation) 
    3333        #then return True else return false 
    34         if elem[:]==[]: 
     34        if elem.getchildren()==[]: 
    3535            return False 
    36         for child in elem[:]: 
     36        for child in elem.getchildren(): 
    3737            if child.tag == '{http://www.w3.org/2001/XMLSchema}element': 
    3838                return True 
     
    6868        return False 
    6969 
    70  
    71  
    7270         
    7371    def __checkChildren(self, parentclassname, elem):      
    7472        #if parentclassname == 'dgMetadataProvenance': 
    7573            #pdb.set_trace() 
    76         for child in elem[:]: 
     74        for child in elem.getchildren(): 
    7775            childname = None 
    7876            if child.attrib.has_key('name'):         
     
    9795                    tmp= self.sequences[parentclassname]                     
    9896                    tmp.append(childname) 
    99                     self.sequences[parentclassname]=tmp              
     97                    self.sequences[parentclassname]=tmp 
    10098                if self.__isParent(child): 
    10199                    if not self.sequences.has_key(childname): 
     
    113111                pass 
    114112             
    115     def setup(self):     
     113    def setup(self): 
    116114        tree = ET.parse(self.schema) 
    117115        root = tree.getroot() 
     
    372370        print key 
    373371        print schema.sequences[key] 
    374  
    375  
    376372  
    377373 
Note: See TracChangeset for help on using the changeset viewer.