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 gen.py
Date Sun, 27 Apr 2003 15:12:28 GMT
rubys       2003/04/27 08:12:28

  Modified:    python   gen.py
  Log:
  Fix indentation which was causing the logic to misbehave
  
  Revision  Changes    Path
  1.12      +20 -19    jakarta-gump/python/gen.py
  
  Index: gen.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gen.py,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- gen.py	26 Apr 2003 10:05:21 -0000	1.11
  +++ gen.py	27 Apr 2003 15:12:28 -0000	1.12
  @@ -38,25 +38,26 @@
       else:
           elements.append((name,var))
   
  -    # format for display
  -    if not elements:
  -       # use compact form for elements without children
  -       if text.strip():
  -           f.write( '%s<%s>%s</%s>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding),text.strip().encode(encoding),nodeName))
  -       else:
  -           f.write( '%s<%s/>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  +  # format for display
  +  if not elements:
  +    # use compact form for elements without children
  +    if text.strip():
  +      f.write( '%s<%s>%s</%s>\n' % (indent,' '.join(attrs).encode(encoding),
  +        text.strip().encode(encoding),nodeName))
       else:
  -       # use full form for elements with children
  -       f.write( '%s<%s>\n' % (indent.encode(encoding),' '.join(attrs).encode(encoding)))
  -       newindent=indent+delta
  -       for (name,var) in elements:
  -         if isinstance(var,list):
  -            # multiple valued elements
  -            for e in var: xmlize(name,e,f,newindent,delta)
  -         elif isinstance(var,Single):
  -            # single valued elements
  -            xmlize(name,var.delegate,f,newindent,delta)
  -            f.write( '%s</%s>\n' % (indent.encode(encoding),nodeName.encode(encoding)))
  +      f.write( '%s<%s/>\n' % (indent,' '.join(attrs).encode(encoding)))
  +  else:
  +   # use full form for elements with children
  +   f.write( '%s<%s>\n' % (indent,' '.join(attrs).encode(encoding)))
  +   newindent=indent+delta
  +   for (name,var) in elements:
  +     if isinstance(var,list):
  +       # multiple valued elements
  +       for e in var: xmlize(name,e,f,newindent,delta)
  +     elif isinstance(var,Single):
  +       # single valued elements
  +       xmlize(name,var.delegate,f,newindent,delta)
  +   f.write( '%s</%s>\n' % (indent,nodeName.encode(encoding)))
   
   
   if __name__=='__main__':
  @@ -85,4 +86,4 @@
   
   
   
  -                                                                 
  +
  
  
  

Mime
View raw message