From 7f121363935be32b345ec80fd15d478bb8d9f23f Mon Sep 17 00:00:00 2001 From: Ameed Ashour Date: Tue, 20 Feb 2018 05:54:33 -0500 Subject: [PATCH] Truncate table size column cause the exception The truncate filter treat an integer as a string and failing. Co-Authored-By: Ivan Kolodyazhny Change-Id: I1a66c3080544e0af8ba02c530351ab4b2d7f9bbd Closes-Bug: #1504397 --- horizon/tables/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/horizon/tables/base.py b/horizon/tables/base.py index b9c1a8e307..437d183973 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -29,6 +29,7 @@ from django.template.defaultfilters import slugify from django.template.defaultfilters import truncatechars from django.template.loader import render_to_string from django import urls +from django.utils import encoding from django.utils.html import escape from django.utils import http from django.utils.http import urlencode @@ -730,6 +731,7 @@ class Cell(html.HTMLElement): # those columns where truncate is False leads to multiple errors # in unit tests data = getattr(datum, column.name, '') or '' + data = encoding.force_text(data) if len(data) > column.truncate: self.attrs['data-toggle'] = 'tooltip' self.attrs['title'] = data