fdemmer / django-weasyprint

A Django class-based view generating PDF resposes using WeasyPrint
Other
352 stars 53 forks source link

HTML.render() got multiple values for argument 'font_config' with Weasyprint 59 #71

Closed floek closed 1 year ago

floek commented 1 year ago

Hi, it seems weasyprint changed its API with v59 and the signature of HTML.render() hast changed. See: https://github.com/Kozea/WeasyPrint/releases/tag/v59.0b1

As a result, django-weasyprint throws an exception with Weasyprint v59:

  File ".../venv/lib/python3.11/site-packages/django_weasyprint/views.py", line 91, in rendered_content
    document = self.get_document()
               ^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.11/site-packages/django_weasyprint/views.py", line 81, in get_document
    return html.render(
           ^^^^^^^^^^^^
TypeError: HTML.render() got multiple values for argument 'font_config'

Maybe you could adapt to the changed API. Thank you!

Best, Floek

troeger commented 1 year ago

You can explicitely install the previous version of weasyprint, before django-weasyprint, in order to work around that problem:

pip install weasyprint==58.0

liZe commented 1 year ago

A pull request has been open to fix this: #70.

fdemmer commented 1 year ago

fixed in v2.2.1