source: products/qTopic/tags/0.1.3/skins/qtopic/export_csv.py

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

Building directory structure

File size: 758 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())
12res = context.queryCatalog()
13fields = fields or context.getExportFields()
14delimiter = context.getDelimiter() or ';'
15if show_header and context.getShowHeader():
16   print delimiter.join(fields)
17for r in res:
18   print delimiter.join([test(getattr(r, f, ''),getattr(r, f, ''),'') for f in fields])
19return printed
Note: See TracBrowser for help on using the repository browser.