Commit fb701a65 authored by Ivan Tyagov's avatar Ivan Tyagov

Use constant for embedded format.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36506 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 805310be
...@@ -57,6 +57,7 @@ enc=base64.encodestring ...@@ -57,6 +57,7 @@ enc=base64.encodestring
dec=base64.decodestring dec=base64.decodestring
_MARKER = [] _MARKER = []
EMBEDDED_FORMAT = '_embedded'
class TimeoutTransport(SafeTransport): class TimeoutTransport(SafeTransport):
"""A xmlrpc transport with configurable timeout. """A xmlrpc transport with configurable timeout.
...@@ -462,7 +463,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File, ...@@ -462,7 +463,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
else: else:
mime = guess_content_type(file_name)[0] mime = guess_content_type(file_name)[0]
data = Pdata(zip_file.read(file_name)) data = Pdata(zip_file.read(file_name))
self.setConversion(data, mime=mime, format='_embedded', file_name=file_name) self.setConversion(data, mime=mime, format=EMBEDDED_FORMAT, file_name=file_name)
if must_close: if must_close:
zip_file.close() zip_file.close()
archive_file.close() archive_file.close()
...@@ -473,9 +474,9 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File, ...@@ -473,9 +474,9 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
try: try:
self._convert(format='html') self._convert(format='html')
web_cache_kw = {'name': name, web_cache_kw = {'name': name,
'format': '_embedded'} 'format': EMBEDDED_FORMAT}
_setCacheHeaders(_ViewEmulator().__of__(self), web_cache_kw) _setCacheHeaders(_ViewEmulator().__of__(self), web_cache_kw)
mime, data = self.getConversion(format='_embedded', file_name=name) mime, data = self.getConversion(format=EMBEDDED_FORMAT, file_name=name)
return OFSFile(name, name, data, content_type=mime).__of__(self.aq_parent) return OFSFile(name, name, data, content_type=mime).__of__(self.aq_parent)
except (NotConvertedError, ConversionError, KeyError): except (NotConvertedError, ConversionError, KeyError):
return PermanentURLMixIn._getExtensibleContent(self, request, name) return PermanentURLMixIn._getExtensibleContent(self, request, name)
......
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