From 730af22bc40077bf8875facb6909b3e12188cbff Mon Sep 17 00:00:00 2001 From: Louis-Dominique Dubeau Date: Sat, 10 Aug 2013 18:30:23 -0400 Subject: [PATCH] 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). --- modoboa/lib/tables.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modoboa/lib/tables.py b/modoboa/lib/tables.py index 5d696c990..cd45d4fdd 100644 --- a/modoboa/lib/tables.py +++ b/modoboa/lib/tables.py @@ -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: