--- a/src/cm/converters/__init__.py Wed Jan 06 16:59:10 2010 +0100
+++ b/src/cm/converters/__init__.py Mon Jan 11 16:29:48 2010 +0100
@@ -1,6 +1,6 @@
-from oo_converters import convert
from pandoc_converters import pandoc_convert
import chardet
+import re
# TODO: move that in text_base: save images
def convert_from_mimetype(file_name, mime_type, format):
@@ -87,7 +87,8 @@
result.append(xhtml[last_index:len(xhtml)])
return u''.join(result)
-def convert_oo_to_html(input):
+def convert_oo_to_html(input):
+ from oo_converters import convert
html_input, images = convert(input, 'html')
enc = chardet.detect(html_input)['encoding']
@@ -103,7 +104,8 @@
raise Exception('UnicodeDecodeError: could not decode')
return res_content_html, images
-def old_convert_oo_to_html(input):
+def old_convert_oo_to_html(input):
+ from oo_converters import convert
html_input, images = convert(input, 'html')
xhtml_input, _not_used_ = convert(input, 'xhtml')
--- a/src/cm/views/export.py Wed Jan 06 16:59:10 2010 +0100
+++ b/src/cm/views/export.py Mon Jan 11 16:29:48 2010 +0100
@@ -5,8 +5,6 @@
from django.template import RequestContext
from django.utils.translation import ugettext as _, ugettext_lazy
from cm.converters.pandoc_converters import pandoc_convert
-from cm.converters.oo_converters import convert_html as oo_convert
-from cm.converters.oo_converters import combine_css_body
from cm.models import Text, TextVersion, Attachment, Comment
import mimetypes
import simplejson
@@ -36,7 +34,9 @@
else :
fix_content = content
if content_format == 'html':
+ from cm.converters.oo_converters import combine_css_body
fix_content = combine_css_body(content, '')
+ from cm.converters.oo_converters import convert_html as oo_convert
export_content = oo_convert(fix_content, format)
export_infos = EXPORT2_INFOS[format]
@@ -58,7 +58,9 @@
else :
fix_content = content
if src_format == 'html':
+ from cm.converters.oo_converters import combine_css_body
fix_content = combine_css_body(content, '')
+ from cm.converters.oo_converters import convert_html as oo_convert
export_content = oo_convert(fix_content, format)
export_infos = EXPORT_INFOS[format]
@@ -151,7 +153,9 @@
else :
fix_content = content
if src_format == 'html':
+ from cm.converters.oo_converters import combine_css_body
fix_content = combine_css_body(content, '')
+ from cm.converters.oo_converters import convert_html as oo_convert
export_content = oo_convert(fix_content, format)
export_infos = EXPORT_INFOS[format]