common/uilib.py
changeset 927 bfcc610c3d5e
parent 525 bd4e03297cf0
child 985 6a25c58a1c23
child 1157 81a383cdda5c
equal deleted inserted replaced
926:6d3d693c0ad5 927:bfcc610c3d5e
   188     Note that spaces are normalized.
   188     Note that spaces are normalized.
   189     """
   189     """
   190     if text is None:
   190     if text is None:
   191         return u''
   191         return u''
   192     words = text.split()
   192     words = text.split()
   193     text = ' '.join(words) # normalize spaces
   193     text = u' '.join(words) # normalize spaces
   194     minlength = len(' '.join(words[:nbwords]))
   194     minlength = len(' '.join(words[:nbwords]))
   195     textlength = text.find('.', minlength) + 1
   195     textlength = text.find('.', minlength) + 1
   196     if textlength == 0: # no point found
   196     if textlength == 0: # no point found
   197         textlength = minlength 
   197         textlength = minlength 
   198     return text[:textlength]
   198     return text[:textlength]