Check for empty value
authorThierry Florac <thierry.florac@onf.fr>
Fri, 07 Sep 2018 17:26:24 +0200
changeset 226 830d5222e806
parent 225 8d7721d95b68
child 227 52a03aa1cf9d
Check for empty value
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 = '<br {0} />'.format('class="{0}"'.format(css_class) if css_class else '')
         return value.replace(character, br)