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 object.py
Date Mon, 14 Jun 2004 13:38:04 GMT
ajack       2004/06/14 06:38:04

  Modified:    python/gump/model Tag: CleanUp object.py
  Log:
  Support variable (i.e. @@DATE@@) expansion.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.24.2.5  +18 -2     gump/python/gump/model/object.py
  
  Index: object.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/object.py,v
  retrieving revision 1.24.2.4
  retrieving revision 1.24.2.5
  diff -u -r1.24.2.4 -r1.24.2.5
  --- object.py	11 Jun 2004 17:09:50 -0000	1.24.2.4
  +++ object.py	14 Jun 2004 13:38:04 -0000	1.24.2.5
  @@ -33,6 +33,7 @@
   from gump.model.propagation import *
   
   class ModelObject(Annotatable,Workable,FileHolder,Propogatable,Ownable):
  +        
       """Base model object for a single entity"""
       def __init__(self,dom,owner=None):
                   
  @@ -122,7 +123,21 @@
           return False   
       
       def getDomAttributeValue(self,name,default=None):
  -        return getDomAttributeValue(self.element,name,default)
  +        return self.expandVariables(
  +                    getDomAttributeValue(self.element,name,default))
  +        
  +    def expandVariables(self,value):    
  +        """
  +        
  +            Return a copy of the value with any Gump
  +            variables expanded.
  +            
  +        """
  +        if not value: return value
  +        
  +        # Right now just one supported
  +        return value.replace('@@DATE@@',default.date)
  +    
           
       def hasDomChild(self,name):
           if hasDomChild(self.element,name): return True
  @@ -132,7 +147,8 @@
           return getDomChild(self.element,name)
           
       def getDomChildValue(self,name,default=None):
  -        return getDomChildValue(self.element,name,default)
  +        return self.expandVariables(
  +                    getDomChildValue(self.element,name,default))
           
       def getDomChildIterator(self,name):
           return getDomChildIterator(self.element,name)
  
  
  

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


Mime
View raw message