Commit b7efad76 authored by Jason Madden's avatar Jason Madden

Fix a TypeError on Python 2 with zope.schema installed.

parent 9825ad5c
......@@ -6,9 +6,18 @@
.. towncrier release notes start
21.1.0 (2021-01-15)
21.1.1 (unreleased)
===================
Bugfixes
--------
Fix a ``TypeError`` on startup on Python 2 with ``zope.schema``
installed. Reported by Josh Zuech.
21.1.0 (2021-01-15)
===================
Bugfixes
--------
......
......@@ -19,6 +19,8 @@ import sys
from zope.interface import Interface
from zope.interface import Attribute
_text_type = type(u'')
try:
from zope import schema
except ImportError: # pragma: no cover
......@@ -26,6 +28,7 @@ except ImportError: # pragma: no cover
__allowed_kw__ = ('readonly', 'min',)
def __init__(self, description, required=False, **kwargs):
description = "%s (required? %s)" % (description, required)
assert isinstance(description, _text_type)
for k in self.__allowed_kw__:
kwargs.pop(k, None)
if kwargs:
......@@ -300,7 +303,7 @@ class ICallback(Interface):
gevent's blocking API; any exception they raise cannot be caught.
"""
pending = schema.Bool(description="Has this callback run yet?",
pending = schema.Bool(description=u"Has this callback run yet?",
readonly=True)
def stop():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment