From 433a02537c8730e23998855fb000e6c7797eeca8 Mon Sep 17 00:00:00 2001 From: Massimo Date: Wed, 3 Oct 2012 11:54:03 -0500 Subject: [PATCH] fixed issue 1064 --- VERSION | 2 +- applications/admin/controllers/appadmin.py | 4 ++++ applications/admin/views/appadmin.html | 6 ++++++ applications/examples/controllers/appadmin.py | 4 ++++ applications/examples/views/appadmin.html | 6 ++++++ applications/welcome/controllers/appadmin.py | 4 ++++ applications/welcome/views/appadmin.html | 6 ++++++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c364805d..2a886d26 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-10-02 14:55:51) dev +Version 2.0.9 (2012-10-03 11:53:40) dev diff --git a/applications/admin/controllers/appadmin.py b/applications/admin/controllers/appadmin.py index fa264bae..b37afc70 100644 --- a/applications/admin/controllers/appadmin.py +++ b/applications/admin/controllers/appadmin.py @@ -207,6 +207,7 @@ def select(): if match: table = match.group('table') try: + tb = None nrows = db(query).count() if form.vars.update_check and form.vars.update_fields: db(query).update(**eval_in_global_env('dict(%s)' @@ -221,6 +222,8 @@ def select(): else: rows = db(query,ignore_common_filters=True).select(limitby=(start, stop)) except Exception, e: + import traceback + tb = traceback.format_exc() (rows, nrows) = ([], 0) response.flash = DIV(T('Invalid Query'),PRE(str(e))) # begin handle upload csv @@ -250,6 +253,7 @@ def select(): rows=rows, query=request.vars.query, formcsv = formcsv, + tb = tb, ) diff --git a/applications/admin/views/appadmin.html b/applications/admin/views/appadmin.html index 72dfc00c..6a933679 100644 --- a/applications/admin/views/appadmin.html +++ b/applications/admin/views/appadmin.html @@ -44,6 +44,12 @@ {{elif request.function=='select':}}

{{=XML(str(T("Database %s select"))%A(request.args[0],_href=URL('index'))) }}

+ {{if tb:}} +

{{=T('Traceback')}}

+
+    {{=tb}}
+  
+ {{pass}} {{if table:}} {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}

{{=T("Rows in Table")}}


diff --git a/applications/examples/controllers/appadmin.py b/applications/examples/controllers/appadmin.py index fa264bae..b37afc70 100644 --- a/applications/examples/controllers/appadmin.py +++ b/applications/examples/controllers/appadmin.py @@ -207,6 +207,7 @@ def select(): if match: table = match.group('table') try: + tb = None nrows = db(query).count() if form.vars.update_check and form.vars.update_fields: db(query).update(**eval_in_global_env('dict(%s)' @@ -221,6 +222,8 @@ def select(): else: rows = db(query,ignore_common_filters=True).select(limitby=(start, stop)) except Exception, e: + import traceback + tb = traceback.format_exc() (rows, nrows) = ([], 0) response.flash = DIV(T('Invalid Query'),PRE(str(e))) # begin handle upload csv @@ -250,6 +253,7 @@ def select(): rows=rows, query=request.vars.query, formcsv = formcsv, + tb = tb, ) diff --git a/applications/examples/views/appadmin.html b/applications/examples/views/appadmin.html index 72dfc00c..6a933679 100644 --- a/applications/examples/views/appadmin.html +++ b/applications/examples/views/appadmin.html @@ -44,6 +44,12 @@ {{elif request.function=='select':}}

{{=XML(str(T("Database %s select"))%A(request.args[0],_href=URL('index'))) }}

+ {{if tb:}} +

{{=T('Traceback')}}

+
+    {{=tb}}
+  
+ {{pass}} {{if table:}} {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}

{{=T("Rows in Table")}}


diff --git a/applications/welcome/controllers/appadmin.py b/applications/welcome/controllers/appadmin.py index fa264bae..b37afc70 100644 --- a/applications/welcome/controllers/appadmin.py +++ b/applications/welcome/controllers/appadmin.py @@ -207,6 +207,7 @@ def select(): if match: table = match.group('table') try: + tb = None nrows = db(query).count() if form.vars.update_check and form.vars.update_fields: db(query).update(**eval_in_global_env('dict(%s)' @@ -221,6 +222,8 @@ def select(): else: rows = db(query,ignore_common_filters=True).select(limitby=(start, stop)) except Exception, e: + import traceback + tb = traceback.format_exc() (rows, nrows) = ([], 0) response.flash = DIV(T('Invalid Query'),PRE(str(e))) # begin handle upload csv @@ -250,6 +253,7 @@ def select(): rows=rows, query=request.vars.query, formcsv = formcsv, + tb = tb, ) diff --git a/applications/welcome/views/appadmin.html b/applications/welcome/views/appadmin.html index 72dfc00c..6a933679 100644 --- a/applications/welcome/views/appadmin.html +++ b/applications/welcome/views/appadmin.html @@ -44,6 +44,12 @@ {{elif request.function=='select':}}

{{=XML(str(T("Database %s select"))%A(request.args[0],_href=URL('index'))) }}

+ {{if tb:}} +

{{=T('Traceback')}}

+
+    {{=tb}}
+  
+ {{pass}} {{if table:}} {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}

{{=T("Rows in Table")}}