[Sqlalchemy-tickets] Issue #3346: ellipses_string in langhelpers.py raises StatementError for non-s
Brought to you by:
zzzeek
|
From: Sebastian E. <iss...@bi...> - 2015-03-30 08:30:58
|
New issue 3346: ellipses_string in langhelpers.py raises StatementError for non-string values https://bitbucket.org/zzzeek/sqlalchemy/issue/3346/ellipses_string-in-langhelperspy-raises Sebastian Elsner: Using 1.0b4. If "value" is not a string, this will raise an exception, which results in a StatementError, when happening in a flush. ``` #!python def ellipses_string(value, len_=25): if len(value) > len_: return "%s..." % value[0:len_] else: return value ``` using: ``` #!python if len(str(value)) > len_: ``` instead, fixes the problem for me, though I do not know if this is a good way. |