source: products/qTopic/trunk/skins/qtopic/export_csv.py @ 1

Last change on this file since 1 was 1, checked in by myroslav, 18 years ago

Building directory structure

File size: 644 bytes
Line 
1## Script (Python) "isATCTbased"
2##title=Formats the history diff
3##bind container=container
4##bind context=context
5##bind namespace=
6##bind script=script
7##bind subpath=traverse_subpath
8##parameters=download=0,fields=None,show_header=1
9if download:
10    context.REQUEST.RESPONSE.setHeader('Content-Type', 'plain/text')
11    context.REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.csv"'% context.getId())
12
13res = context.queryCatalog()
14fields = fields or context.getCustomViewFields()
15csv_data = []
16for r in res:
17    csv_data.append(dict([(f, getattr(r, f, ''))for f in fields]))
18return context.toCSV(fields, csv_data)
Note: See TracBrowser for help on using the repository browser.