Force to use python-docx 0.8.7
This commit is contained in:
parent
651b59fc21
commit
12e709f80b
@ -1,3 +1,8 @@
|
||||
0.5.16 (2019-01-11)
|
||||
-------------------
|
||||
- Force to use python-docx 0.8.7 (#170)
|
||||
- Add getting undeclared variables in the template (#171)
|
||||
|
||||
0.5.15 (2019-01-02)
|
||||
-------------------
|
||||
- Added `PAGE_BREAK` feature (#168)
|
||||
|
||||
@ -6,7 +6,7 @@ Created : 2015-03-12
|
||||
'''
|
||||
import functools
|
||||
|
||||
__version__ = '0.5.15'
|
||||
__version__ = '0.5.16'
|
||||
|
||||
from lxml import etree
|
||||
from docx import Document
|
||||
@ -41,14 +41,6 @@ class DocxTemplate(object):
|
||||
HEADER_URI = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"
|
||||
FOOTER_URI = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
|
||||
|
||||
@property
|
||||
def undeclared_template_variables(self):
|
||||
xml = self.get_xml()
|
||||
xml = self.patch_xml(xml)
|
||||
env = Environment()
|
||||
parse_content = env.parse(xml)
|
||||
return meta.find_undeclared_variables(parse_content)
|
||||
|
||||
def __init__(self, docx):
|
||||
self.docx = Document(docx)
|
||||
self.crc_to_new_media = {}
|
||||
@ -564,6 +556,14 @@ class DocxTemplate(object):
|
||||
self.docx.save(filename,*args,**kwargs)
|
||||
self.post_processing(filename)
|
||||
|
||||
@property
|
||||
def undeclared_template_variables(self):
|
||||
xml = self.get_xml()
|
||||
xml = self.patch_xml(xml)
|
||||
env = Environment()
|
||||
parse_content = env.parse(xml)
|
||||
return meta.find_undeclared_variables(parse_content)
|
||||
|
||||
|
||||
class Subdoc(object):
|
||||
""" Class for subdocument to insert into master document """
|
||||
|
||||
5
setup.py
5
setup.py
@ -53,7 +53,10 @@ setup(name='docxtpl',
|
||||
author_email='elapouya@gmail.com',
|
||||
license='LGPL 2.1',
|
||||
packages=['docxtpl'],
|
||||
install_requires=['six', 'python-docx', 'jinja2', 'lxml'],
|
||||
install_requires=['six',
|
||||
'python-docx<=0.8.7', # newer docx package breaks header/footer management in docxtpl
|
||||
'jinja2',
|
||||
'lxml'],
|
||||
extras_require={'docs': ['Sphinx', 'sphinxcontrib-napoleon']},
|
||||
eager_resources=['docs'],
|
||||
zip_safe=False)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user