Skip to content

Commit

Permalink
[#2939] Fix bug in jinja2 truncate on None
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 3, 2012
1 parent e0729ab commit 24c539b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ckan/lib/jinja_extensions.py
Expand Up @@ -29,6 +29,8 @@ def truncate(value, length=255, killwords=None, end='...'):
''' A more clever truncate. If killwords is supplied we use the default
truncate. Otherwise we try to truncate using killwords=False, if this
truncates the whole value we try again with killwords=True '''
if value is None:
return None
if killwords is not None:
return do_truncate(value, length=length, killwords=killwords, end=end)
result = do_truncate(value, length=length, killwords=False, end=end)
Expand Down

0 comments on commit 24c539b

Please sign in to comment.