Ignore:
Timestamp:
27/05/06 20:53:27 (14 years ago)
Author:
lawrence
Message:

Fixed problems with history and select cookie handling.
From a cookie perspective, still need to get the NDG
cookie stuff in ... (and still got the major problem
with unparseable difs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/StubB/XSLT/browse/portal/cgi/DIF.py

    r1048 r1049  
    1919        #self.xml=unicode(xml,'latin-1') 
    2020        #self.xml=xml.encode('latin-1','replace') 
    21   
     21        encodings=['ascii',]#['latin-1','ascii','iso-8859-1'] 
    2222        try: 
    23             self.elem=ET.fromstring(xml) 
     23            for option in encodings: 
     24                try: 
     25                    s=xml.encode(option,'replace') 
     26                     
     27                    self.elem=ET.fromstring(s) 
     28                    self.xml=s 
     29                except UnicodeError: 
     30                    pass 
     31                else: 
     32                    break 
    2433        except: 
    2534            # for some reason we can't parse the document ... 
     
    2938            #f=codecs.open('unparseable.xml','a','utf-8') 
    3039            #f.write(xml+'\n') 
     40            print '<p>'+s[11360:11420]+'</p>' 
     41            raise  
    3142            self.elem=None 
    3243            return 
Note: See TracChangeset for help on using the changeset viewer.