Commit 5315f223 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Make messages and LOG more consistent with ERP5 style.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16734 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dd84987f
############################################################################## ##############################################################################
# #
# Copyright (c) 2002-2006 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002-2006 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2006-2007 Nexedi SA and Contributors. All Rights Reserved.
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsability of assessing all potential
...@@ -46,7 +47,6 @@ dec=base64.decodestring ...@@ -46,7 +47,6 @@ dec=base64.decodestring
_MARKER = [] _MARKER = []
STANDARD_IMAGE_FORMAT_LIST = ('png', 'jpg', 'gif', ) STANDARD_IMAGE_FORMAT_LIST = ('png', 'jpg', 'gif', )
class TimeoutTransport(SafeTransport): class TimeoutTransport(SafeTransport):
"""A xmlrpc transport with configurable timeout. """A xmlrpc transport with configurable timeout.
""" """
...@@ -178,7 +178,7 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -178,7 +178,7 @@ class OOoDocument(File, ConversionCacheMixin):
address = preference_tool.getPreferredOoodocServerAddress() address = preference_tool.getPreferredOoodocServerAddress()
port = preference_tool.getPreferredOoodocServerPortNumber() port = preference_tool.getPreferredOoodocServerPortNumber()
if address in ('', None) or port in ('', None) : if address in ('', None) or port in ('', None) :
raise ConversionError('[DMS] Can not proceed with conversion:' raise ConversionError('OOoDocument: can not proceed with conversion:'
' conversion server host and port is not defined in preferences') ' conversion server host and port is not defined in preferences')
return address, port return address, port
...@@ -224,7 +224,7 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -224,7 +224,7 @@ class OOoDocument(File, ConversionCacheMixin):
else: else:
# This is very temporary code - XXX needs to be changed # This is very temporary code - XXX needs to be changed
# so that the system can retry # so that the system can retry
raise ConversionError("[DMS] Can not get list of allowed acceptable" raise ConversionError("OOoDocument: can not get list of allowed acceptable"
" formats for conversion: %s (%s)" % ( " formats for conversion: %s (%s)" % (
response_code, response_message)) response_code, response_message))
...@@ -314,9 +314,9 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -314,9 +314,9 @@ class OOoDocument(File, ConversionCacheMixin):
""" """
#XXX if document is empty, stop to try to convert. #XXX if document is empty, stop to try to convert.
#XXX but I don't know what is a appropriate mime-type.(Yusei) #XXX but I don't know what is a appropriate mime-type.(Yusei)
if self.get_size()==0: if self.get_size() == 0:
return 'text/plain', '' return 'text/plain', ''
# Make sure we can support html and pdf by default # Make sure we can support html and pdf by default
is_html = 0 is_html = 0
original_format = format original_format = format
...@@ -348,7 +348,7 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -348,7 +348,7 @@ class OOoDocument(File, ConversionCacheMixin):
return 'text/plain', self.asTextContent() return 'text/plain', self.asTextContent()
# Raise an error if the format is not supported # Raise an error if the format is not supported
if not self.isTargetFormatAllowed(format): if not self.isTargetFormatAllowed(format):
raise ConversionError("[DMS] Target format %s is not supported" % format) raise ConversionError("OOoDocument: target format %s is not supported" % format)
# Check if we have already a base conversion # Check if we have already a base conversion
if not self.hasBaseData(): if not self.hasBaseData():
self.convertToBaseFormat() self.convertToBaseFormat()
...@@ -449,14 +449,10 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -449,14 +449,10 @@ class OOoDocument(File, ConversionCacheMixin):
if metadata.get('MIMEType', None) is not None: if metadata.get('MIMEType', None) is not None:
self._setBaseContentType(metadata['MIMEType']) self._setBaseContentType(metadata['MIMEType'])
else: else:
# log and raise errors with converting server.
LOG('ERP5OOo', ERROR,
'[DMS] Error converting document to base format %s:%s'
% (response_code, response_message))
# Explicitly raise the exception! # Explicitly raise the exception!
raise ConversionError( raise ConversionError(
"[DMS] Error converting document to base format %s:%s:" "OOoDocument: Error converting document to base format %s:%s:"
%(response_code, response_message)) % (response_code, response_message))
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getContentInformation') 'getContentInformation')
...@@ -484,10 +480,7 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -484,10 +480,7 @@ class OOoDocument(File, ConversionCacheMixin):
# successful meta data extraction # successful meta data extraction
self._setBaseData(dec(response_dict['data'])) self._setBaseData(dec(response_dict['data']))
else: else:
# log and raise errors with converting server.
LOG('ERP5OOo', ERROR, "[DMS] Error getting document's metadata %s:%s"
% (response_code, response_message))
# Explicitly raise the exception! # Explicitly raise the exception!
raise ConversionError("[DMS] Error getting document's metadata %s:%s" raise ConversionError("OOoDocument: error getting document metadata %s:%s"
% (response_code, response_message)) % (response_code, response_message))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment