diff options
Diffstat (limited to 'ishtar_common/views.py')
| -rw-r--r-- | ishtar_common/views.py | 21 | 
1 files changed, 8 insertions, 13 deletions
| diff --git a/ishtar_common/views.py b/ishtar_common/views.py index b5f56652c..6f18f8daa 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1,6 +1,6 @@  #!/usr/bin/env python  # -*- coding: utf-8 -*- -# Copyright (C) 2010-2014  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2015  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as @@ -17,10 +17,7 @@  # See the file COPYING for details. -try: -    import tidy -except: -    from tidylib import tidy_document as tidy +from tidylib import tidy_document as tidy  import re  import csv @@ -519,17 +516,15 @@ def show_item(model, name):              filename = item.history_object.associated_filename          else:              filename = item.associated_filename -        if doc_type == "odt" and settings.XHTML2ODT_PATH and \ -           settings.ODT_TEMPLATE: +        if doc_type == "odt" and settings.ODT_TEMPLATE:              tpl = loader.get_template('ishtar/sheet_%s.html' % name)              content = tpl.render(context_instance)              try: -                tidy_options = dict(output_xhtml=1, add_xml_decl=1, indent=1, -                        tidy_mark=0, output_encoding='utf8', doctype='auto', -                        wrap=0, char_encoding='utf8') -                html = str(tidy.parseString(content.encode('utf-8'), -                                            **tidy_options)) -                html = html.replace(" ", " ") +                tidy_options = {'output-xhtml':1, 'indent':1, +                                'tidy-mark':0, 'doctype':'auto', +                                'add-xml-decl':1, 'wrap':1} +                html, errors = tidy(content, options=tidy_options) +                html = html.encode('utf-8').replace(" ", " ")                  html = re.sub('<pre([^>]*)>\n', '<pre\\1>', html)                  odt = NamedTemporaryFile() | 
