Skip to content

Commit

Permalink
hotfix: regression on document generation caused by invalid html.clos…
Browse files Browse the repository at this point in the history
…e on weasyprint
  • Loading branch information
danh91 committed Dec 12, 2024
1 parent 509de68 commit 44e0981
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions modules/documents/karrio/server/documents/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,12 @@ def generate(

buffer = io.BytesIO()
html = weasyprint.HTML(string=content, encoding="utf-8")

try:
html.write_pdf(
buffer,
stylesheets=STYLESHEETS,
font_config=FONT_CONFIG,
optimize_size=("fonts", "images"),
)
finally:
html.close()
html.write_pdf(
buffer,
stylesheets=STYLESHEETS,
font_config=FONT_CONFIG,
optimize_size=("fonts", "images"),
)

return buffer

Expand Down
2 changes: 1 addition & 1 deletion modules/documents/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="karrio.server.documents",
version="2024.12rc3",
version="2024.12rc5",
description="Multi-carrier shipping API apps module",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 44e0981

Please sign in to comment.