If a limit is specified, we have to make sure the value is a string before trying to limit it, otherwise the code fails if the value is not a string (e.g. an integer).

This commit is contained in:
Louis-Dominique Dubeau
2013-09-07 14:20:30 -04:00
parent 80e8bd0564
commit 730af22bc4
+5 -2
View File
@@ -42,8 +42,11 @@ class Column(object):
col["value"] = row[self.name]
try:
limit = getattr(self, "limit")
if len(col["value"]) > limit:
col["value"] = col["value"][0:limit] + "..."
if limit:
# The value is not necessarily a string, so...
col["value"] = str(col["value"])
if len(col["value"]) > limit:
col["value"] = col["value"][0:limit] + "..."
except AttributeError:
pass
try: