Changeset 151

Show
Ignore:
Timestamp:
Sun Mar 18 04:11:22 2007
Author:
manatlan
Message:

- matej patch to against inclusion of non-PCDATA in db

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/tools.py

    r138 r151  
    106 106         outerr = string.join(p.stderr.readlines() ).strip()  
    107 107  
      108  
      109         # ======================================================== patch matej  
      110         # Protect against crappy output of some unnamed (ehm,  
      111         # ehm, jhead) programs.  
      112         nonPCData = ''  
      113         # These are codes of characters which are not PCDATA  
      114         # and so they cannot happen in XML file.  
      115         nonPCDataRange = range(0x00,0x08)+[0x0b,0x0c]+range(0x0e,0x19)  
      116         # The following ones are stricly speaking not incorrect (and XML parse  
      117         # won't choke on them), but they are unprintable control  
      118         # characters, so they will probably never happen in  
      119         # metadata.  
      120         nonPCDataRange += range(0x7f,0x9f)  
      121         for i in nonPCDataRange:  
      122            nonPCData += chr(i)  
      123         allchars = string.maketrans('','')  
      124         out = out.translate(allchars,nonPCData)  
      125         outerr = outerr.translate(allchars,nonPCData)  
      126         # ======================================================== patch matej  
      127  
      128  
    108 129         if "jhead" in cmdline:  
    109 130            if "Nonfatal Error" in outerr: