Changeset 5 for trunk/python


Ignore:
Timestamp:
Mar 22, 2005 8:01:22 AM (16 years ago)
Author:
mmc
Message:

Fixed the library.get() method to coalesce multiple text
nodes into a single value. That way, if you put(append=1)
multiple times, you get back the entire value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/Rappture/library.py

    r4 r5  
    122122
    123123        clist = node.childNodes
    124         if len(clist) == 1 and isinstance(clist[0],minidom.Text):
    125             return clist[0].nodeValue.strip()
    126 
    127         return None
     124        rval = None
     125        for node in [n for n in clist if isinstance(n,minidom.Text)]:
     126            if rval == None:
     127                rval = node.nodeValue
     128            else:
     129                rval += node.nodeValue
     130        if rval:
     131            rval = rval.strip()
     132        return rval
    128133
    129134    # ------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.