# HG changeset patch # User Thierry Florac # Date 1536333984 -7200 # Node ID 830d5222e8065c7560d62c84fa4ee183e036cb11 # Parent 8d7721d95b68c46795132de1af2d07baba7ffc6f Check for empty value diff -r 8d7721d95b68 -r 830d5222e806 src/pyams_utils/text.py --- a/src/pyams_utils/text.py Sat Jul 21 00:16:17 2018 +0200 +++ b/src/pyams_utils/text.py Fri Sep 07 17:26:24 2018 +0200 @@ -15,19 +15,19 @@ # import standard library import html + import docutils.core +from pyramid.interfaces import IRequest +from zope.interface import Interface +from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm +# import packages +from pyams_utils.adapter import ContextRequestAdapter, ContextRequestViewAdapter, adapter_config # import interfaces from pyams_utils.interfaces.tales import ITALESExtension from pyams_utils.interfaces.text import IHTMLRenderer -from pyramid.interfaces import IRequest - -# import packages -from pyams_utils.adapter import ContextRequestAdapter, ContextRequestViewAdapter, adapter_config from pyams_utils.request import check_request from pyams_utils.vocabulary import vocabulary_config -from zope.interface import Interface -from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm def get_text_start(text, length, max=0): @@ -164,5 +164,7 @@ @staticmethod def render(value, css_class='', character='|'): + if not value: + return '' br = '
'.format('class="{0}"'.format(css_class) if css_class else '') return value.replace(character, br)