plone / plone.app.theming

Integrates the Diazo theming engine with Plone
https://docs.plone.org/external/plone.app.theming/docs/index.html
Other
21 stars 30 forks source link

TypeError: a bytes-like object is required, not 'str' #209

Open frapell opened 2 years ago

frapell commented 2 years ago

When on Python 3 with Zope 5.1 or 5.2 (This issue is fixed on Zope 5.3 and up), you get

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module plone.app.theming.browser.controlpanel, line 73, in __call__
  Module plone.app.theming.browser.controlpanel, line 191, in update
TypeError: a bytes-like object is required, not 'str'

When trying to save custom styles from /@@theming-controlpanel -> Advanced Settings -> Custom Styles

To reproduce:

  1. Have a Plone 5 instance with Python 3, using Zope 5.1 or 5.2

  2. Visit /@@theming-controlpanel and add some Parameter expressions under Advanced settings -> Theme details, for instance

    url = context/absolute_url
    portal_url = portal_state/portal_url
  3. Go to Custom Styles and try to save some custom CSS, for instance

    body{
    color:red;
    }
  4. Click Save

mauritsvanrees commented 2 years ago

I can have a look later. But one thing jumps out:

Have a Plone 5 instance with Python 3, using Zope 5.1 or 5.2

This is not supported. Plone 5 only works with Zope 4. Or at least it is only tested with Zope 4. I would not recommend using a higher Zope version.

frapell commented 2 years ago

Yeah... I don't quite remember why we went to Zope 5 honestly... But we haven't had any issues (except this :P) Is there any specific concern it comes to your mind about it?