Merge pull request #47 from nostalgiaz/master

Supporting py3
This commit is contained in:
Eric Lapouyade 2016-08-09 17:08:12 +02:00 committed by GitHub
commit 053bbdfdef
2 changed files with 8 additions and 3 deletions

View File

@ -98,8 +98,12 @@ class DocxTemplate(object):
def build_headers_footers_xml(self,context, uri,jinja_env=None):
for relKey, xml in self.get_headers_footers_xml(uri):
if six.PY3:
xml = xml.decode('utf-8')
encoding = self.get_headers_footers_encoding(xml)
xml = self.patch_xml(xml).decode(encoding)
xml = self.patch_xml(xml)
if not six.PY3:
xml = xml.decode(encoding)
xml = self.render_xml(xml, context, jinja_env)
yield relKey, xml.encode(encoding)

View File

@ -1,12 +1,13 @@
import subprocess
import glob
import six
tests = glob.glob('[A-Za-z]*.py')
excludes = ['runtests.py']
for test in tests:
if test not in excludes:
print '%s ...' % test
six.print_('%s ...' % test)
subprocess.call(['python','./%s' % test])
print 'Done.'
six.print_('Done.')