From 36fdd2e04fc09969f729568bba91b62ee7c99953 Mon Sep 17 00:00:00 2001 From: kirsn Date: Mon, 26 Jan 2015 00:25:52 +0530 Subject: [PATCH] Issue 2037: apply truncate correctly --- gluon/sqlhtml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 03007b09..a2b6107c 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -3197,13 +3197,13 @@ class SQLTABLE(TABLE): r = '' elif field.type in ['string', 'text']: r = str(field.formatter(r)) + truncate_by = truncate if headers != {}: # new implement dict if isinstance(headers[colname], dict): if isinstance(headers[colname]['truncate'], int): - r = truncate_string( - r, headers[colname]['truncate']) - elif not truncate is None: - r = truncate_string(r, truncate) + truncate_by = headers[colname]['truncate'] + if not truncate_by is None: + r = truncate_string(r, truncate_by) attrcol = dict() # new implement dict if headers != {}: if isinstance(headers[colname], dict):