Skip to content

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

@frapell

Description

@frapell

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
  1. Go to Custom Styles and try to save some custom CSS, for instance
body{
color:red;
}
  1. Click Save

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions