Changeset 392
- Timestamp:
- 07/12/06 09:18:17
- Files:
-
- qTopic/branches/plone2.1/Extensions/Install.py (modified) (2 diffs)
- qTopic/branches/plone2.1/skins/qtopic/export_csv.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qTopic/branches/plone2.1/Extensions/Install.py
r391 r392 8 8 def install(self): 9 9 out = StringIO() 10 10 11 11 installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) 12 12 print >> out, 'Types Installed' … … 14 14 install_subskin(self, out, GLOBALS) 15 15 print >> out, 'Skins Installed' 16 17 pact = getToolByName(self, 'portal_actions') 18 pact.addAction( 'export_csv', 19 'Export in CSV', 20 'string:$object_url/export_csv?download=1', 21 'python:(object.meta_type == "qTopic") or (object.meta_type == "ATTopic")', 22 'View', 23 'document_actions') 24 pact_icons = getToolByName(self, 'portal_actionicons') 25 pact_icons.addActionIcon('plone', 26 'export_csv', 27 'topic_icon.gif', 28 'Export in CSV') 16 29 17 30 out.write('Installation %s successfully completed.\n' % PROJECTNAME) qTopic/branches/plone2.1/skins/qtopic/export_csv.py
r391 r392 10 10 context.REQUEST.RESPONSE.setHeader('Content-Type', 'plain/text') 11 11 context.REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.csv"'% context.getId()) 12 12 13 res = context.queryCatalog() 13 14 fields = fields or context.getCustomViewFields() 14 delimiter = context.getDelimiter() or ';' 15 if show_header and context.getShowHeader(): 16 print delimiter.join(fields) 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 17 29 for r in res: 18 30 print delimiter.join([test(getattr(r, f, ''),getattr(r, f, ''),'') for f in fields])
