summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Bauer <bauer@starzel.de>2018-09-13 09:42:50 +0200
committerPhilip Bauer <bauer@starzel.de>2018-09-13 09:42:50 +0200
commit934dd362b9326d9f5d1e13e27cf9e8d7f5c87d65 (patch)
treef50a8c02f046afd3750ef30fff0c5e3dbf167713
parent7d715edc318479445d6666c872c1cd8d714251c9 (diff)
downloadzope-schema-fix_init_on_none_description.tar.gz
Fix field-constructor when description is None (fix #69)fix_init_on_none_description
-rw-r--r--CHANGES.rst3
-rw-r--r--src/zope/schema/_bootstrapfields.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index ddd242c..bd97dc1 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,7 +5,8 @@
4.7.1 (unreleased)
==================
-- Nothing changed yet.
+- Fix the ``Field`` constructor when description is None. See
+ `issue 69 <https://github.com/zopefoundation/zope.schema/issues/69>`_.
4.7.0 (2018-09-11)
diff --git a/src/zope/schema/_bootstrapfields.py b/src/zope/schema/_bootstrapfields.py
index 12cc2ec..8e8fd57 100644
--- a/src/zope/schema/_bootstrapfields.py
+++ b/src/zope/schema/_bootstrapfields.py
@@ -242,7 +242,10 @@ class Field(Attribute):
# Fix leading whitespace that occurs when using multi-line
# strings, but don't overwrite the original, we need to
# preserve it (it could be a MessageID).
- doc_description = '\n'.join(_DocStringHelpers.docstring_to_lines(description)[:-1])
+ if not description:
+ doc_description = u''
+ else:
+ doc_description = '\n'.join(_DocStringHelpers.docstring_to_lines(description)[:-1])
if title:
if doc_description: