def _logException(self, instance):
     if instance and hasattr(instance, 'getPhysicalPath'):
         path = '/'.join(instance.getPhysicalPath())
         filename = self.getFilename(instance)
         msg = 'EXCEPTION object: %s, file: %s: \n' % (path, filename)
         LOG.warning(msg, exc_info=True)
     else:
         LOG.warning('Exception occured', exc_info=True)
##        # Try to use / guess the encoding
##        out_encoding = out.getMetadata().get('encoding', None)
##        if out_encoding:
##            Log(LOG_DEBUG, "Have encoding", out_encoding)
##            output = unicode(output, encoding = out_encoding, )
##        else:
##            # Convert from encoded string to unicode
##            for enc in AVAILABLE_ENCODINGS:
##                try:
##                    Log(LOG_DEBUG, "Trying encoding", enc)
##                    output = output.decode(enc, )
##                    break

##                except UnicodeError:
##                    Log(LOG_DEBUG, "Encoding", enc, "failed.")
##                    pass

##        # Return an encoded output
##        return self.unicode2string(output, instance)


try:
    import libxml2
    import libxslt
except:
    LOG.warning("""libxml2 or libxslt not available. Under windows, download it at http://users.skynet.be/sbi/libxml-python/
    Open-Office indexing will be disabled.""")
else:
    from ooconverter import oo_to_html
    AttachmentHandler.registerHandler(OOAttachment)