Last change
on this file since 1 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
File size:
925 bytes
|
Rev | Line | |
---|
[1] | 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 |
---|
| 9 | if download: |
---|
| 10 | context.REQUEST.RESPONSE.setHeader('Content-Type', 'plain/text') |
---|
| 11 | context.REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.csv"'% context.getId()) |
---|
| 12 | |
---|
| 13 | res = context.queryCatalog() |
---|
| 14 | fields = fields or context.getCustomViewFields() |
---|
| 15 | |
---|
| 16 | if hasattr(context, 'getDelimiter'): |
---|
| 17 | delimiter = context.getDelimiter() or ';' |
---|
| 18 | else: |
---|
| 19 | delimiter = ',' |
---|
| 20 | |
---|
| 21 | if hasattr(context, 'getShowHeader'): |
---|
| 22 | if show_header and context.getShowHeader(): |
---|
| 23 | print delimiter.join(fields) |
---|
| 24 | else: |
---|
| 25 | if show_header: |
---|
| 26 | print delimiter.join(fields) |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | for r in res: |
---|
| 30 | print delimiter.join([test(getattr(r, f, ''),getattr(r, f, ''),'') for f in fields]) |
---|
| 31 | return printed |
---|
Note: See
TracBrowser
for help on using the repository browser.