Changeset 2266


Ignore:
Timestamp:
13/03/07 11:52:39 (12 years ago)
Author:
lawrence
Message:

modified page layout to report unicode errors (temporary expedient)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/wsgi/ndgPageLayout.py

    r2097 r2266  
    22from paste.request import parse_querystring 
    33 
     4debug=1 
    45def DiscoveryFrameFactory(global_config,**local_conf): 
    56     
     
    8081            insert=self.discovery+self.disclaimer 
    8182        self.footer='''<div id="Footer">%s</div></div></body></html>'''%insert 
    82         for i in self.wrapTarget(environ,start_response): response+=i 
     83        try: 
     84            if debug: 
     85                for i in self.wrapTarget(environ,start_response): response+=i 
     86            else: 
     87                for i in self.wrapTarget(environ,start_response): response+=str(i) 
     88        except UnicodeEncodeError: 
     89            response+='''<p> Problems with data content, records untranslatable! </p>  
     90            <p>Please eport this error to the badc (badc@rl.ac.uk) with "Discovery UNICODE  
     91            error in the subject line" and cut and paste the url <i>to this message</i>  
     92            in the message body</p>''' 
    8393        if footer: response+=self.footer 
    8494        #currently need to coerce response into a string for flup ... 
    85         return [str(response)] 
    86          
     95        return [response] 
    8796         
    8897    def __buildHeader(self,configFile): 
Note: See TracChangeset for help on using the changeset viewer.