-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
29 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
from docxtpl import DocxTemplate | ||
from jinja2.exceptions import TemplateError | ||
import six | ||
|
||
six.print_("=" * 80) | ||
six.print_("Generating template error for testing (so it is safe to ignore) :") | ||
six.print_("." * 80) | ||
print("=" * 80) | ||
print("Generating template error for testing (so it is safe to ignore) :") | ||
print("." * 80) | ||
try: | ||
tpl = DocxTemplate("templates/template_error_tpl.docx") | ||
tpl.render({"test_variable": "test variable value"}) | ||
except TemplateError as the_error: | ||
six.print_(six.text_type(the_error)) | ||
print(str(the_error)) | ||
if hasattr(the_error, "docx_context"): | ||
six.print_("Context:") | ||
print("Context:") | ||
for line in the_error.docx_context: | ||
six.print_(line) | ||
print(line) | ||
tpl.save("output/template_error.docx") | ||
six.print_("." * 80) | ||
six.print_(" End of TemplateError Test ") | ||
six.print_("=" * 80) | ||
print("." * 80) | ||
print(" End of TemplateError Test ") | ||
print("=" * 80) |