gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: jakarta-gump/python/gump gen.py view.py
Date Fri, 02 May 2003 12:26:42 GMT
rubys       2003/05/02 05:26:41

  Modified:    python/gump gen.py view.py
  Log:
  Make xmlize easier to use
  
  Revision  Changes    Path
  1.5       +11 -5     jakarta-gump/python/gump/gen.py
  
  Index: gen.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/gen.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- gen.py	30 Apr 2003 23:28:53 -0000	1.4
  +++ gen.py	2 May 2003 12:26:41 -0000	1.5
  @@ -77,9 +77,11 @@
   #                     Dump the object module as XML                     #
   #########################################################################
   
  -def xmlize(nodeName,object,f,indent='',delta='  '):
  +def xmlize(nodeName,object,f=None,indent='',delta='  '):
     from xml.sax.saxutils import escape
  -  import types
  +  import types, StringIO
  +
  +  if f==None: f=StringIO.StringIO()
   
     attrs=[nodeName]
     elements=[]
  @@ -125,6 +127,10 @@
           xmlize(name,var.delegate,f,newindent,delta)
       f.write( '%s</%s>\n' % (indent,nodeName.encode(encoding)))
   
  +  # if the file is a StringIO buffer, return the contents
  +  if isinstance(f,StringIO.StringIO):
  +    f.seek(0)
  +    return f.read()
   
   if __name__=='__main__':
     # -----------DISABLED-----------
  
  
  
  1.13      +1 -5      jakarta-gump/python/gump/view.py
  
  Index: view.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/view.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- view.py	2 May 2003 11:42:48 -0000	1.12
  +++ view.py	2 May 2003 12:26:41 -0000	1.13
  @@ -208,11 +208,7 @@
       if project.viewdata:
         self.data.AppendText(project.viewdata)
       else:
  -      import StringIO
  -      data = StringIO.StringIO()
  -      xmlize('project',project,data,)
  -      data.seek(0)
  -      self.data.AppendText(data.read())
  +      self.data.AppendText(xmlize('project',project))
         self.data.ShowPosition(0)
   
       # gather a list of project dependencies unrolled to build
  
  
  

Mime
View raw message