This was never really intended to work but now I see some people are using it this way and we may need to restore backward compatibility. It may be possible to do so. Let me try.
On Jan 6, 1:28 am, Neveen Adel <nevo.a...@gmail.com> wrote: > I am using the following code to generate csv file: > > "" > import gluon.contenttype > response.headers['Content-Type'] = \ > gluon.contenttype.contenttype('.csv') > response.headers['Content-disposition'] = 'attachment; > filename=members_approaching_renewal_report.csv'\ > #% tuple(request.vars.query.split('.')[:2]) > rows=db().select() > #rows.colnames=('field1','field2') > return str(rows) > "" > > The commented line was working fine with version 1.72.3 and after > upgrade web2py version it causes the previous exception. > > On Jan 6, 12:22 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > I am. I will probably apply all the patches tonight or tomorrow. I > > also have Sphinx patch from Tim. > > > Massimo > > > On Jan 5, 3:45 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > > Are you not receiving any of my attachments by email? > > > > -Thadeus > > > > On Tue, Jan 5, 2010 at 2:35 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > waiting for the patch by email.... > > > > > On Jan 5, 12:13 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > >> Ah duh, column names... > > > > >> Here would be a proper fix. > > > > >> colnames = kwargs.get('colnames', self.colnames) > > > >> # a proper csv starting with the column names > > > >> writer.writerow(colnames) > > > > >> So > > > > >> export_to_csv(..., colnames=['Field1', 'Field2', 'Field3',] > > > > >> -Thadeus > > > > >> On Tue, Jan 5, 2010 at 11:58 AM, Thadeus Burgess > > > >> <thade...@thadeusb.com> wrote: > > > >> > ... > > > > >> > There is a way of using the represent attribute... > > > > >> > so export_to_csv(..., represent=True) > > > > >> > Will use the fields represent attribute > > > > >> > db.table.field.represent = lambda id: .... > > > > >> > -Thadeus > > > > >> > On Tue, Jan 5, 2010 at 10:39 AM, mdipierro <mdipie...@cs.depaul.edu> > > > >> > wrote: > > > >> >> as a short term trunk, you could just replace the first line in a > > > >> >> the > > > >> >> csv file. > > > > >> >> On Jan 5, 10:37 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > >> >>> Right now there is no way to customize the column names in > > > >> >>> export_to_csv_file. > > > >> >>> We could add it. do you call export_to_csv_file explicitly? > > > > >> >>> On Jan 5, 10:23 am, Neveen Adel <nevo.a...@gmail.com> wrote: > > > > >> >>> > I want to rename The column names to be readable to users and > > > >> >>> > then i > > > >> >>> > will generate the csv report by str(family_members) so i cant use > > > >> >>> > SQLTable. > > > > >> >>> > And by using > > > >> >>> > db.member.name.label = name > > > >> >>> > db.member.member_id = member ID > > > > >> >>> > the columns are displayed with their names e.g: member.name and > > > >> >>> > member.membership_id > > > > >> >>> > so please do you have any suggestions > > > > >> >>> > Thanks > > > > >> >>> > On Jan 5, 4:38 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > >> >>> > > Please do not override family_members.colnames. This was an > > > >> >>> > > internal > > > >> >>> > > thing and its behavior changed in 1.72.* > > > >> >>> > > Use db.table.field.label instead or SQLTABLE(rows,headers={}) > > > >> >>> > > depending on what you need. > > > > >> >>> > > On Jan 5, 4:12 am, Neveen Adel <nevo.a...@gmail.com> wrote: > > > > >> >>> > > > when i do the following code: > > > > >> >>> > > > family_members =db(db.member.id == membership_id).select > > > >> >>> > > > (db.member.name,db.member.id) > > > >> >>> > > > family_members.colnames = ('Name ','Membership ID') > > > > >> >>> > > > It cause the following error > > > >> >>> > > > "" > > > >> >>> > > > Traceback (most recent call last): > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > restricted.py", line 184, in restricted > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/resources/web2py/New_version/web2py_src/ > > > >> >>> > > > web2py/applications/init/views/default/updateMember.html", > > > >> >>> > > > line 142, > > > >> >>> > > > in <module> > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > globals.py", line 112, in write > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > html.py", line 103, in xmlescape > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > sql.py", line 3326, in xml > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > sqlhtml.py", line 980, in __init__ > > > >> >>> > > > File > > > >> >>> > > > "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ > > > >> >>> > > > sql.py", line 621, in __getattr__ > > > >> >>> > > > KeyError: '_extra' > > > > >> >>> > > > "" > > > >> >>> > > > P.s. : when i commented the lone (family_members.colnames = > > > >> >>> > > > ('Name > > > >> >>> > > > ','Membership ID')) it works fine i dont why?? > > > > >> >>> > > > Thanks > > > > >> >> -- > > > >> >> You received this message because you are subscribed to the Google > > > >> >> Groups "web2py-users" group. > > > >> >> To post to this group, send email to web...@googlegroups.com. > > > >> >> To unsubscribe from this group, send email to > > > >> >> web2py+unsubscr...@googlegroups.com. > > > >> >> For more options, visit this group > > > >> >> athttp://groups.google.com/group/web2py?hl=en. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "web2py-users" group. > > > > To post to this group, send email to web...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > web2py+unsubscr...@googlegroups.com. > > > > For more options, visit this group > > > > athttp://groups.google.com/group/web2py?hl=en. > >
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.