Changeset 4499 for exist


Ignore:
Timestamp:
27/11/08 09:57:49 (11 years ago)
Author:
cbyrom
Message:

Improve error logging when testing for valid unicode.

Location:
exist/trunk/python/ndgUtils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/lib/utilities.py

    r4494 r4499  
    190190        elif unicode(inputString, 'utf-8'): 
    191191            isValid = True 
     192    except UnicodeDecodeError, e: 
     193        logging.debug("Error encountered: %s" %e.reason) 
    192194    except Exception, e: 
    193195        logging.debug(e.message) 
     
    207209    ''' 
    208210    correctedString = cgi.escape(inputString) 
    209     if not isValidUnicode(inputString): 
    210         raise ValueError("Input string, '%s', contains illegal characters" %inputString) 
    211     #correctedString = encodeIntoHTMLNumericalCodes(correctedString) 
    212     #correctedString = escape(correctedString, entities=esc_chars) 
    213211     
    214212    if inputString != correctedString: 
  • exist/trunk/python/ndgUtils/models/existdbclient.py

    r4493 r4499  
    215215        logging.info("Retrieving info for file, '%s'" %docPath) 
    216216         
    217         doc = self.xmldb.executeQuery('doc("' + docPath + '")') 
    218          
    219         if doc[1]['hits'] == 0: 
     217        id, doc = self.xmldb.executeQuery('doc("' + docPath + '")') 
     218         
     219        if doc['hits'] == 0: 
    220220            logging.info("File does not exist in eXist DB") 
    221221            return None 
    222222        logging.info("Found file - returning result ID") 
    223         return doc[0] 
     223        return id 
    224224          
    225225 
Note: See TracChangeset for help on using the changeset viewer.