Re: [web2py] Re: export csv
Forget one thing : def export_csv(): rows = db((db.tab1.id == *request.get_vars['tab1_id']*)).select() return dict(rows=rows) On Thu, Mar 15, 2012 at 6:16 PM, Richard Vézina wrote: > I get it to work like this : > > > def export_csv(): > rows = db((db.tab1.id == tab1_id)).select() > return dict(rows=rows) > > def export_default_analysis_request(): > tab1_subset = (db.tab1.bool1 == True) > form = SQLFORM.factory( > Field('tab1_id', requires=IS_IN_DB(db(tab1_subset),'tab1.id > ','%(f1)s')), > submit_button=T('Submit')) > if form.accepts(request.vars, session): > response.flash = T('form accepted') > * redirect(URL(a=request.application, c='C', f='export_csv.csv', > vars=dict(tab1_id=form.vars.tab1_id)))* > elif form.errors: > response.flash = T('form has errors') > else: > response.flash = T('please fill out the form') > return dict(form=form) > > And I put this in /views/C/export_csv.csv as explain in the book : > > {{ > import cStringIO > stream=cStringIO.StringIO() > rows.export_to_csv_file(stream) > response.headers['Content-Type']='application/vnd.ms-excel' > response.write(stream.getvalue(), escape=False) > }} > > And it works fine, the only thing is that I get a blank page... I could > probably set a ajax call instead of redirect later. > > Richard > > > On Wed, Mar 14, 2012 at 8:18 PM, Richard Vézina < > ml.richard.vez...@gmail.com> wrote: > >> Ho yeah, I forget about that option... >> >> Thanks Alan >> >> Richard >> >> >> On Wed, Mar 14, 2012 at 6:53 PM, Alan Etkin wrote: >> >>> I have not experience with the book csv output example, but it looks >>> different than your implementation: >>> >>> -It has a special view "/name.csv" to render the function output >>> -The Content-Type parameter is "application-vnd.ms-excel" >>> >>> I think you could change the response view parameter on form >>> validation to .../name.csv, have the function to return a dict object >>> and use the book example view to return the csv file response. >>> >>> The example I am refering to is in section 10.1.6 >>> >>> On 14 mar, 18:19, Richard wrote: >>> > Hello, >>> > >>> > I strungle with export of csv... I have this function that works great >>> : >>> > >>> > def export_csv(tab1_id): >>> > import gluon.contenttype >>> > response.headers['Content-Type'] = \ >>> > gluon.contenttype.contenttype('.csv') >>> > import cStringIO >>> > stream=cStringIO.StringIO() >>> > db((db.tab1.id == tab1_id)).select().export_to_csv_file(stream) >>> > response.headers['Content-disposition'] = 'attachment; >>> filename=%s.csv' >>> > % 'test12345' >>> > response.write(stream.getvalue()) >>> > >>> > def export_default_analysis_request(): >>> > tab1_subset = (db.tab1.bool1 == True) >>> > form = SQLFORM.factory( >>> > Field('tab1_id', >>> > requires=IS_IN_DB(db(tab1_subset),'tab1.id','%(f1)s')), >>> > submit_button=T('Submit')) >>> > if form.accepts(request.vars, session): >>> > response.flash = T('form accepted') >>> > export_csv(tab1_id = form.vars.tab1_id) >>> > elif form.errors: >>> > response.flash = T('form has errors') >>> > else: >>> > response.flash = T('please fill out the form') >>> > return dict(form=form) >>> > >>> > The problem is that I am getting the html page below the value I want >>> to >>> > export... >>> > >>> > Do I need to redirect on a blank page? It likes if response contain the >>> > actual page that get out at the same time as the data... >>> > >>> > I just copy stuff from here and there, but I think I will have to >>> better >>> > understand what is going on... >>> > >>> > Thanks >>> > >>> > Richard >>> >> >> >
Re: [web2py] Re: export csv
I get it to work like this : def export_csv(): rows = db((db.tab1.id == tab1_id)).select() return dict(rows=rows) def export_default_analysis_request(): tab1_subset = (db.tab1.bool1 == True) form = SQLFORM.factory( Field('tab1_id', requires=IS_IN_DB(db(tab1_subset),'tab1.id ','%(f1)s')), submit_button=T('Submit')) if form.accepts(request.vars, session): response.flash = T('form accepted') * redirect(URL(a=request.application, c='C', f='export_csv.csv', vars=dict(tab1_id=form.vars.tab1_id)))* elif form.errors: response.flash = T('form has errors') else: response.flash = T('please fill out the form') return dict(form=form) And I put this in /views/C/export_csv.csv as explain in the book : {{ import cStringIO stream=cStringIO.StringIO() rows.export_to_csv_file(stream) response.headers['Content-Type']='application/vnd.ms-excel' response.write(stream.getvalue(), escape=False) }} And it works fine, the only thing is that I get a blank page... I could probably set a ajax call instead of redirect later. Richard On Wed, Mar 14, 2012 at 8:18 PM, Richard Vézina wrote: > Ho yeah, I forget about that option... > > Thanks Alan > > Richard > > > On Wed, Mar 14, 2012 at 6:53 PM, Alan Etkin wrote: > >> I have not experience with the book csv output example, but it looks >> different than your implementation: >> >> -It has a special view "/name.csv" to render the function output >> -The Content-Type parameter is "application-vnd.ms-excel" >> >> I think you could change the response view parameter on form >> validation to .../name.csv, have the function to return a dict object >> and use the book example view to return the csv file response. >> >> The example I am refering to is in section 10.1.6 >> >> On 14 mar, 18:19, Richard wrote: >> > Hello, >> > >> > I strungle with export of csv... I have this function that works great : >> > >> > def export_csv(tab1_id): >> > import gluon.contenttype >> > response.headers['Content-Type'] = \ >> > gluon.contenttype.contenttype('.csv') >> > import cStringIO >> > stream=cStringIO.StringIO() >> > db((db.tab1.id == tab1_id)).select().export_to_csv_file(stream) >> > response.headers['Content-disposition'] = 'attachment; >> filename=%s.csv' >> > % 'test12345' >> > response.write(stream.getvalue()) >> > >> > def export_default_analysis_request(): >> > tab1_subset = (db.tab1.bool1 == True) >> > form = SQLFORM.factory( >> > Field('tab1_id', >> > requires=IS_IN_DB(db(tab1_subset),'tab1.id','%(f1)s')), >> > submit_button=T('Submit')) >> > if form.accepts(request.vars, session): >> > response.flash = T('form accepted') >> > export_csv(tab1_id = form.vars.tab1_id) >> > elif form.errors: >> > response.flash = T('form has errors') >> > else: >> > response.flash = T('please fill out the form') >> > return dict(form=form) >> > >> > The problem is that I am getting the html page below the value I want to >> > export... >> > >> > Do I need to redirect on a blank page? It likes if response contain the >> > actual page that get out at the same time as the data... >> > >> > I just copy stuff from here and there, but I think I will have to better >> > understand what is going on... >> > >> > Thanks >> > >> > Richard >> > >
Re: [web2py] Re: export csv
Ho yeah, I forget about that option... Thanks Alan Richard On Wed, Mar 14, 2012 at 6:53 PM, Alan Etkin wrote: > I have not experience with the book csv output example, but it looks > different than your implementation: > > -It has a special view "/name.csv" to render the function output > -The Content-Type parameter is "application-vnd.ms-excel" > > I think you could change the response view parameter on form > validation to .../name.csv, have the function to return a dict object > and use the book example view to return the csv file response. > > The example I am refering to is in section 10.1.6 > > On 14 mar, 18:19, Richard wrote: > > Hello, > > > > I strungle with export of csv... I have this function that works great : > > > > def export_csv(tab1_id): > > import gluon.contenttype > > response.headers['Content-Type'] = \ > > gluon.contenttype.contenttype('.csv') > > import cStringIO > > stream=cStringIO.StringIO() > > db((db.tab1.id == tab1_id)).select().export_to_csv_file(stream) > > response.headers['Content-disposition'] = 'attachment; > filename=%s.csv' > > % 'test12345' > > response.write(stream.getvalue()) > > > > def export_default_analysis_request(): > > tab1_subset = (db.tab1.bool1 == True) > > form = SQLFORM.factory( > > Field('tab1_id', > > requires=IS_IN_DB(db(tab1_subset),'tab1.id','%(f1)s')), > > submit_button=T('Submit')) > > if form.accepts(request.vars, session): > > response.flash = T('form accepted') > > export_csv(tab1_id = form.vars.tab1_id) > > elif form.errors: > > response.flash = T('form has errors') > > else: > > response.flash = T('please fill out the form') > > return dict(form=form) > > > > The problem is that I am getting the html page below the value I want to > > export... > > > > Do I need to redirect on a blank page? It likes if response contain the > > actual page that get out at the same time as the data... > > > > I just copy stuff from here and there, but I think I will have to better > > understand what is going on... > > > > Thanks > > > > Richard >
[web2py] Re: export csv
I have not experience with the book csv output example, but it looks different than your implementation: -It has a special view "/name.csv" to render the function output -The Content-Type parameter is "application-vnd.ms-excel" I think you could change the response view parameter on form validation to .../name.csv, have the function to return a dict object and use the book example view to return the csv file response. The example I am refering to is in section 10.1.6 On 14 mar, 18:19, Richard wrote: > Hello, > > I strungle with export of csv... I have this function that works great : > > def export_csv(tab1_id): > import gluon.contenttype > response.headers['Content-Type'] = \ > gluon.contenttype.contenttype('.csv') > import cStringIO > stream=cStringIO.StringIO() > db((db.tab1.id == tab1_id)).select().export_to_csv_file(stream) > response.headers['Content-disposition'] = 'attachment; filename=%s.csv' > % 'test12345' > response.write(stream.getvalue()) > > def export_default_analysis_request(): > tab1_subset = (db.tab1.bool1 == True) > form = SQLFORM.factory( > Field('tab1_id', > requires=IS_IN_DB(db(tab1_subset),'tab1.id','%(f1)s')), > submit_button=T('Submit')) > if form.accepts(request.vars, session): > response.flash = T('form accepted') > export_csv(tab1_id = form.vars.tab1_id) > elif form.errors: > response.flash = T('form has errors') > else: > response.flash = T('please fill out the form') > return dict(form=form) > > The problem is that I am getting the html page below the value I want to > export... > > Do I need to redirect on a blank page? It likes if response contain the > actual page that get out at the same time as the data... > > I just copy stuff from here and there, but I think I will have to better > understand what is going on... > > Thanks > > Richard
[web2py] Re: Export CSV
Worked ! On Feb 3, 5:41 pm, Anthony wrote: > On Friday, February 3, 2012 6:16:09 PM UTC-5, Omi Chiba wrote: > > > Do I need to rewrite this "export_csv" function completely ? or Can I > > just add import csv and set QUOTE_ALL ? > > > Controller > > -- > > def export_csv(): > > import gluon.contenttype > > response.headers['Content-Type'] = \ > > gluon.contenttype.contenttype('.csv') > > db = request.args[0] > > query = 'db.IQWAGFTY.TYPRCD!=""' > > response.headers['Content-disposition'] = 'attachment; > > filename=IQWAGFTY.csv' > > return str(db(query,ignore_common_filters=True).select()) > > Instead of: > > return str(db(query,ignore_common_filters=True).select()) > > I think you could do something like: > > import csv > import cStringIO > rows = db(query,ignore_common_filters=True).select() > s = cStringIO.StringIO() > rows.export_to_csv_file(s, quoting=csv.QUOTE_ALL) > return s.getvalue() > > str(rows) actually does exactly the same as the above, but the above method > allows you to pass additional arguments to export_to_csv_file(). > > Anthony
[web2py] Re: Export CSV
On Friday, February 3, 2012 6:16:09 PM UTC-5, Omi Chiba wrote: > > Do I need to rewrite this "export_csv" function completely ? or Can I > just add import csv and set QUOTE_ALL ? > > > Controller > -- > def export_csv(): > import gluon.contenttype > response.headers['Content-Type'] = \ > gluon.contenttype.contenttype('.csv') > db = request.args[0] > query = 'db.IQWAGFTY.TYPRCD!=""' > response.headers['Content-disposition'] = 'attachment; > filename=IQWAGFTY.csv' > return str(db(query,ignore_common_filters=True).select()) > Instead of: return str(db(query,ignore_common_filters=True).select()) I think you could do something like: import csv import cStringIO rows = db(query,ignore_common_filters=True).select() s = cStringIO.StringIO() rows.export_to_csv_file(s, quoting=csv.QUOTE_ALL) return s.getvalue() str(rows) actually does exactly the same as the above, but the above method allows you to pass additional arguments to export_to_csv_file(). Anthony
[web2py] Re: Export CSV
Do I need to rewrite this "export_csv" function completely ? or Can I just add import csv and set QUOTE_ALL ? Controller -- def export_csv(): import gluon.contenttype response.headers['Content-Type'] = \ gluon.contenttype.contenttype('.csv') db = request.args[0] query = 'db.IQWAGFTY.TYPRCD!=""' response.headers['Content-disposition'] = 'attachment; filename=IQWAGFTY.csv' return str(db(query,ignore_common_filters=True).select()) On Feb 3, 4:36 pm, Anthony wrote: > On Friday, February 3, 2012 4:03:47 PM UTC-5, Omi Chiba wrote: > > > Oh my god, it worked again!! > > > >I also want to export the csv file with " " for characters. > > Do you know if we can do this ? I want do quotechar='"' just like the > > following link. > > >http://www.web2py.com/books/default/chapter/29/6?search=csv#Data-repr... > > I think the default is to use double quotes, but you have to set the > "quoting" arg to tell it what to quote -- > seehttp://docs.python.org/release/3.1.3/library/csv.html#module-contents > for details. It defaults to csv.QUOTE_MINIMAL, which only quotes values > that require quoting because they contain special characters. If you want > to quote everything, use quoting=csv.QUOTE_ALL (be sure to import csv > first). > > Anthony > > > > > > > > > > > On Feb 3, 2:54 pm, Anthony wrote: > > > Take your query out of quotes -- a query has to be a DAL Query object, > > but > > > you have simply passed in a string. > > > > Anthony > > > > On Friday, February 3, 2012 3:31:23 PM UTC-5, Omi Chiba wrote: > > > > > I want to export the specific table data to csv. I tried the code > > > > after appadmin but I got a "TypeError: 'str' object is not callable" > > > > error. Can you guys help ? > > > > > I also want to export the csv file with " " for characters. > > > > > Model > > > > -- > > > > db.define_table('IQWAGFTY', > > > > Field('TYPRCD', length=15), > > > > Field('TYPRKJ', length=50), > > > > Field('TYTYPE', length=2), > > > > primarykey=['TYPRCD']) > > > > > Controller > > > > -- > > > > def export_csv(): > > > > import gluon.contenttype > > > > response.headers['Content-Type'] = \ > > > > gluon.contenttype.contenttype('.csv') > > > > db = request.args[0] > > > > query = 'db.IQWAGFTY.TYPRCD!=""' > > > > response.headers['Content-disposition'] = 'attachment; > > > > filename=IQWAGFTY.csv' > > > > return str(db(query,ignore_common_filters=True).select()) > > > > > def index(): > > > > if request.vars.csvfile != None: > > > > import_csv(db[request.vars.table],request.vars.csvfile.file) > > > > response.flash = T('data uploaded') > > > > return dict() > > > > > View - default/index > > > > -- > > > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > > > {{extend 'layout.html'}} > > > > > Step 1. Download file > > > > [ {{="export as > > > > csv file"}} ] > > > > > Traceback > > > > -- > > > > Traceback (most recent call last): > > > > File "C:\web2py\gluon\restricted.py", line 204, in restricted > > > > exec ccode in environment > > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > > default.py", line 82, in > > > > File "C:\web2py\gluon\globals.py", line 172, in > > > > self._caller = lambda f: f() > > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > > default.py", line 22, in export_csv > > > > return str(db(query,ignore_common_filters=True).select()) > > > > TypeError: 'str' object is not callable
[web2py] Re: Export CSV
On Friday, February 3, 2012 4:03:47 PM UTC-5, Omi Chiba wrote: > > Oh my god, it worked again!! > > >I also want to export the csv file with " " for characters. > Do you know if we can do this ? I want do quotechar='"' just like the > following link. > > > http://www.web2py.com/books/default/chapter/29/6?search=csv#Data-representation > > I think the default is to use double quotes, but you have to set the "quoting" arg to tell it what to quote -- see http://docs.python.org/release/3.1.3/library/csv.html#module-contents for details. It defaults to csv.QUOTE_MINIMAL, which only quotes values that require quoting because they contain special characters. If you want to quote everything, use quoting=csv.QUOTE_ALL (be sure to import csv first). Anthony > > > > > On Feb 3, 2:54 pm, Anthony wrote: > > Take your query out of quotes -- a query has to be a DAL Query object, > but > > you have simply passed in a string. > > > > Anthony > > > > > > > > > > > > > > > > On Friday, February 3, 2012 3:31:23 PM UTC-5, Omi Chiba wrote: > > > > > I want to export the specific table data to csv. I tried the code > > > after appadmin but I got a "TypeError: 'str' object is not callable" > > > error. Can you guys help ? > > > > > I also want to export the csv file with " " for characters. > > > > > Model > > > -- > > > db.define_table('IQWAGFTY', > > > Field('TYPRCD', length=15), > > > Field('TYPRKJ', length=50), > > > Field('TYTYPE', length=2), > > > primarykey=['TYPRCD']) > > > > > Controller > > > -- > > > def export_csv(): > > > import gluon.contenttype > > > response.headers['Content-Type'] = \ > > > gluon.contenttype.contenttype('.csv') > > > db = request.args[0] > > > query = 'db.IQWAGFTY.TYPRCD!=""' > > > response.headers['Content-disposition'] = 'attachment; > > > filename=IQWAGFTY.csv' > > > return str(db(query,ignore_common_filters=True).select()) > > > > > def index(): > > > if request.vars.csvfile != None: > > > import_csv(db[request.vars.table],request.vars.csvfile.file) > > > response.flash = T('data uploaded') > > > return dict() > > > > > View - default/index > > > -- > > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > > {{extend 'layout.html'}} > > > > > Step 1. Download file > > > [ {{="export as > > > csv file"}} ] > > > > > Traceback > > > -- > > > Traceback (most recent call last): > > > File "C:\web2py\gluon\restricted.py", line 204, in restricted > > > exec ccode in environment > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > default.py", line 82, in > > > File "C:\web2py\gluon\globals.py", line 172, in > > > self._caller = lambda f: f() > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > default.py", line 22, in export_csv > > > return str(db(query,ignore_common_filters=True).select()) > > > TypeError: 'str' object is not callable
Re: [web2py] Re: Export CSV
OK. Can you send me the 4th ed markmin files ? On Fri, Feb 3, 2012 at 3:03 PM, Omi Chiba wrote: > Oh my god, it worked again!! > > >I also want to export the csv file with " " for characters. > Do you know if we can do this ? I want do quotechar='"' just like the > following link. > > > http://www.web2py.com/books/default/chapter/29/6?search=csv#Data-representation > > > > > On Feb 3, 2:54 pm, Anthony wrote: > > Take your query out of quotes -- a query has to be a DAL Query object, > but > > you have simply passed in a string. > > > > Anthony > > > > > > > > > > > > > > > > On Friday, February 3, 2012 3:31:23 PM UTC-5, Omi Chiba wrote: > > > > > I want to export the specific table data to csv. I tried the code > > > after appadmin but I got a "TypeError: 'str' object is not callable" > > > error. Can you guys help ? > > > > > I also want to export the csv file with " " for characters. > > > > > Model > > > -- > > > db.define_table('IQWAGFTY', > > > Field('TYPRCD', length=15), > > > Field('TYPRKJ', length=50), > > > Field('TYTYPE', length=2), > > > primarykey=['TYPRCD']) > > > > > Controller > > > -- > > > def export_csv(): > > > import gluon.contenttype > > > response.headers['Content-Type'] = \ > > > gluon.contenttype.contenttype('.csv') > > > db = request.args[0] > > > query = 'db.IQWAGFTY.TYPRCD!=""' > > > response.headers['Content-disposition'] = 'attachment; > > > filename=IQWAGFTY.csv' > > > return str(db(query,ignore_common_filters=True).select()) > > > > > def index(): > > > if request.vars.csvfile != None: > > > import_csv(db[request.vars.table],request.vars.csvfile.file) > > > response.flash = T('data uploaded') > > > return dict() > > > > > View - default/index > > > -- > > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > > {{extend 'layout.html'}} > > > > > Step 1. Download file > > > [ {{="export as > > > csv file"}} ] > > > > > Traceback > > > -- > > > Traceback (most recent call last): > > > File "C:\web2py\gluon\restricted.py", line 204, in restricted > > > exec ccode in environment > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > default.py", line 82, in > > > File "C:\web2py\gluon\globals.py", line 172, in > > > self._caller = lambda f: f() > > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > > default.py", line 22, in export_csv > > > return str(db(query,ignore_common_filters=True).select()) > > > TypeError: 'str' object is not callable >
[web2py] Re: Export CSV
Oh my god, it worked again!! >I also want to export the csv file with " " for characters. Do you know if we can do this ? I want do quotechar='"' just like the following link. http://www.web2py.com/books/default/chapter/29/6?search=csv#Data-representation On Feb 3, 2:54 pm, Anthony wrote: > Take your query out of quotes -- a query has to be a DAL Query object, but > you have simply passed in a string. > > Anthony > > > > > > > > On Friday, February 3, 2012 3:31:23 PM UTC-5, Omi Chiba wrote: > > > I want to export the specific table data to csv. I tried the code > > after appadmin but I got a "TypeError: 'str' object is not callable" > > error. Can you guys help ? > > > I also want to export the csv file with " " for characters. > > > Model > > -- > > db.define_table('IQWAGFTY', > > Field('TYPRCD', length=15), > > Field('TYPRKJ', length=50), > > Field('TYTYPE', length=2), > > primarykey=['TYPRCD']) > > > Controller > > -- > > def export_csv(): > > import gluon.contenttype > > response.headers['Content-Type'] = \ > > gluon.contenttype.contenttype('.csv') > > db = request.args[0] > > query = 'db.IQWAGFTY.TYPRCD!=""' > > response.headers['Content-disposition'] = 'attachment; > > filename=IQWAGFTY.csv' > > return str(db(query,ignore_common_filters=True).select()) > > > def index(): > > if request.vars.csvfile != None: > > import_csv(db[request.vars.table],request.vars.csvfile.file) > > response.flash = T('data uploaded') > > return dict() > > > View - default/index > > -- > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > {{extend 'layout.html'}} > > > Step 1. Download file > > [ {{="export as > > csv file"}} ] > > > Traceback > > -- > > Traceback (most recent call last): > > File "C:\web2py\gluon\restricted.py", line 204, in restricted > > exec ccode in environment > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > default.py", line 82, in > > File "C:\web2py\gluon\globals.py", line 172, in > > self._caller = lambda f: f() > > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > > default.py", line 22, in export_csv > > return str(db(query,ignore_common_filters=True).select()) > > TypeError: 'str' object is not callable
[web2py] Re: Export CSV
Take your query out of quotes -- a query has to be a DAL Query object, but you have simply passed in a string. Anthony On Friday, February 3, 2012 3:31:23 PM UTC-5, Omi Chiba wrote: > > I want to export the specific table data to csv. I tried the code > after appadmin but I got a "TypeError: 'str' object is not callable" > error. Can you guys help ? > > I also want to export the csv file with " " for characters. > > > Model > -- > db.define_table('IQWAGFTY', > Field('TYPRCD', length=15), > Field('TYPRKJ', length=50), > Field('TYTYPE', length=2), > primarykey=['TYPRCD']) > > > Controller > -- > def export_csv(): > import gluon.contenttype > response.headers['Content-Type'] = \ > gluon.contenttype.contenttype('.csv') > db = request.args[0] > query = 'db.IQWAGFTY.TYPRCD!=""' > response.headers['Content-disposition'] = 'attachment; > filename=IQWAGFTY.csv' > return str(db(query,ignore_common_filters=True).select()) > > def index(): > if request.vars.csvfile != None: > import_csv(db[request.vars.table],request.vars.csvfile.file) > response.flash = T('data uploaded') > return dict() > > View - default/index > -- > {{left_sidebar_enabled=right_sidebar_enabled=False}} > {{extend 'layout.html'}} > > Step 1. Download file > [ {{="export as > csv file"}} ] > > Traceback > -- > Traceback (most recent call last): > File "C:\web2py\gluon\restricted.py", line 204, in restricted > exec ccode in environment > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > default.py", line 82, in > File "C:\web2py\gluon\globals.py", line 172, in > self._caller = lambda f: f() > File "C:/web2py/applications/Inventory_Reserve_Admin/controllers/ > default.py", line 22, in export_csv > return str(db(query,ignore_common_filters=True).select()) > TypeError: 'str' object is not callable >