From 4df82d3a6ecdfe395393baadf0ca17491121ba35 Mon Sep 17 00:00:00 2001 From: "Jan M. Knaup" Date: Wed, 15 Oct 2014 11:03:31 +0200 Subject: [PATCH] in SQLTABLE, fixed use of REGEX_TABLE_DOT_FIELD leading to ignoring calculated / aggregate columns --- gluon/sqlhtml.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 98d4395a..a100681b 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -3001,12 +3001,16 @@ class SQLTABLE(TABLE): return REGEX_TABLE_DOT_FIELD = sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD if not columns: - columns = [c for c in sqlrows.colnames if REGEX_TABLE_DOT_FIELD.match(c)] + columns = list(sqlrows.colnames) if headers == 'fieldname:capitalize': headers = {} for c in columns: - (t, f) = REGEX_TABLE_DOT_FIELD.match(c).groups() - headers[t + '.' + f] = f.replace('_', ' ').title() + tfmatch=REGEX_TABLE_DOT_FIELD.match(c) + if tfmatch: + (t, f) = REGEX_TABLE_DOT_FIELD.match(c).groups() + headers[t + '.' + f] = f.replace('_', ' ').title() + else: + headers[c]=c elif headers == 'labels': headers = {} for c in columns: @@ -3025,7 +3029,7 @@ class SQLTABLE(TABLE): headers = {} else: for c in columns: # new implement dict - c = '.'.join(REGEX_TABLE_DOT_FIELD.match(c).groups()) + c = str(c) if isinstance(headers.get(c, c), dict): coldict = headers.get(c, c) attrcol = dict()