gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump/python/gump/model project.py misc.py
Date Mon, 19 Jul 2004 20:34:01 GMT
ajack       2004/07/19 13:34:01

  Modified:    python/gump/model project.py misc.py
  Log:
  Found another use of DOM after complete(). Zapped it, and others like it.
  
  Revision  Changes    Path
  1.90      +4 -0      gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/project.py,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- project.py	19 Jul 2004 19:57:57 -0000	1.89
  +++ project.py	19 Jul 2004 20:34:00 -0000	1.90
  @@ -421,22 +421,26 @@
           # Grab all the work
           for w in self.getDomChildIterator('work'):
               work=Work(w,self)
  +            work.complete()
               self.works.append(work)
   
           # Grab all the mkdirs
           for m in self.getDomChildIterator('mkdir'):
               mkdir=Mkdir(m,self)
  +            mkdir.complete()
               self.mkdirs.append(mkdir)
   
           # Grab all the deleted
           for d in self.getDomChildIterator('delete'):
               delete=Delete(d,self)
  +            delete.complete()
               self.deletes.append(delete)
   
           # Grab all the reports (junit for now)
           if self.hasDomChild('junitreport'):
               junitreport=self.getDomChild('junitreport')
               report=JunitReport(junitreport,self)
  +            report.complete()
               self.reports.append(report)
               
           # Grab all notifications
  
  
  
  1.3       +60 -30    gump/python/gump/model/misc.py
  
  Index: misc.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/misc.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- misc.py	8 Jul 2004 20:33:07 -0000	1.2
  +++ misc.py	19 Jul 2004 20:34:01 -0000	1.3
  @@ -130,22 +130,32 @@
           return self.type
   
   class Resolvable(ModelObject):
  +    """
  +    A ModelObject that can be resolved relative to it's owning model or workspace
  +    e.g. JUnitReport or Work
  +    """
       def __init__(self,dom,owner):
  -        ModelObject.__init__(self,dom,owner)                
  +        ModelObject.__init__(self,dom,owner)     
  +        self.path=None           
  +        
  +    def complete(self):
  +        if self.isComplete(): return     
           
  -    def getResolvedPath(self):  
  -        path=None
           
           if self.hasDomAttribute('nested'):
  -            path=os.path.abspath(
  -                    os.path.join(	self.owner.getModule().getWorkingDirectory(),
  +            self.path=os.path.abspath(
  +                    os.path.join(    self.owner.getModule().getWorkingDirectory(),
                                       self.getDomAttributeValue('nested')))
           elif self.hasDomAttribute('parent'):
  -            path=os.path.abspath(
  +            self.path=os.path.abspath(
                       os.path.join(self.owner.getWorkspace().getBaseDirectory(),
                                    self.getDomAttributeValue('parent')))
                                    
  -        return path
  +        # Done, don't redo
  +        self.setComplete(True)    
  +        
  +    def getResolvedPath(self):  
  +        return self.path
                 
   # represents a <junitreport/> element
   class JunitReport(Resolvable):
  @@ -165,12 +175,10 @@
       """
       def __init__(self,dom,owner):
           ModelObject.__init__(self,dom,owner)   
  -        
  -    def hasDirectory(self):
  -        return self.hasDomAttribute('dir')             
  -        
  -    def getDirectory(self):  
  -        path=None
  +        self.dir=None        
  +                
  +    def complete(self):
  +        if self.isComplete(): return     
           
           if self.hasDomAttribute('dir'):
               dirString=self.getDomAttributeValue('dir')
  @@ -182,11 +190,26 @@
                                       dirString, self.__class__.__name__)
                   dirString='bogus'
               
  -            path=os.path.abspath(
  -                    os.path.join(    self.owner.getModule().getWorkingDirectory(),
  -                                    dirString))
  -                                 
  -        return path 
  +            self.dir=os.path.abspath(
  +                        os.path.join( self.owner.getModule().getWorkingDirectory(),
  +                                        dirString))
  +        
  +        # Done, don't redo
  +        self.setComplete(True)    
  +
  +    def hasDirectory(self):
  +        """
  +        Does it have a directory?
  +        """
  +        if self.dir: return True
  +        return False
  +                
  +    def getDirectory(self):  
  +        """ 
  +        Get the directory. 
  +        """
  +        return self.dir
  +        
           
   # represents a <mkdir/> element
   class Mkdir(DirResolvable):
  @@ -197,13 +220,13 @@
   class Delete(DirResolvable): 
       def __init__(self,dom,owner):
           DirResolvable.__init__(self,dom,owner)    
  - 
  -    def hasFile(self):
  -        return self.hasDomAttribute('file')             
  +        self.file=None
           
  -    def getFile(self):  
  -        path=None
  +    def complete(self):
  +        if self.isComplete(): return    
           
  +        DirResolvable.complete(self)
  +      
           if self.hasDomAttribute('file'):
               file=self.getDomAttributeValue('file')
               
  @@ -213,13 +236,20 @@
                   self.owner.addError('Bad file attribute %s on <%s' % \
                                       file, self.__class__.__name__)
                   file='bogus'
  -            
  -            
  -            path=os.path.abspath(
  -                    os.path.join(    self.owner.getModule().getWorkingDirectory(),
  -                                    file))
  -                                 
  -        return path    
  +                        
  +            self.file=os.path.abspath(
  +                        os.path.join( self.owner.getModule().getWorkingDirectory(),
  +                                        file))
  +        
  +        # Done, don't redo
  +        self.setComplete(True)    
  +        
  +    def hasFile(self):
  +        if self.file: return True
  +        return False
  +        
  +    def getFile(self):  
  +        return self.file 
           
   class AddressPair:
       def __init__(self,toAddr,fromAddr):
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message