From 1641b10e79d32d605b12e8771ac68e9c00c9dd31 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 30 Aug 2012 15:26:58 -0500 Subject: [PATCH] cacheable select in grid, thanks Anthony --- VERSION | 2 +- gluon/sqlhtml.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 56bbcbad..1abebcec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.2 (2012-08-30 15:20:33) stable +Version 2.0.2 (2012-08-30 15:26:54) stable diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 145fe029..b93b5b6e 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -1826,14 +1826,15 @@ class SQLFORM(FORM): try: dbset = dbset(SQLFORM.build_query( fields,request.vars.get('keywords',''))) - rows = dbset.select() + rows = dbset.select(cacheable=True) except Exception, e: response.flash = T('Internal Error') rows = [] else: - rows = dbset.select() + rows = dbset.select(cacheable=True) else: - rows = dbset.select(left=left,orderby=orderby,*columns) + rows = dbset.select(left=left,orderby=orderby, + cacheable=True*columns) if export_type in exportManager: value = exportManager[export_type] @@ -1892,7 +1893,8 @@ class SQLFORM(FORM): try: if left or groupby: c = 'count(*)' - nrows = dbset.select(c,left=left,groupby=groupby).first()[c] + nrows = dbset.select(c,left=left,cacheable=True, + groupby=groupby).first()[c] else: nrows = dbset.count() except: @@ -1976,7 +1978,9 @@ class SQLFORM(FORM): try: table_fields = [f for f in fields if f._tablename in tablenames] - rows = dbset.select(left=left,orderby=orderby,groupby=groupby,limitby=limitby,*table_fields) + rows = dbset.select(left=left,orderby=orderby, + groupby=groupby,limitby=limitby, + cacheable=True,*table_fields) except SyntaxError: rows = None error = T("Query Not Supported")