This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

The data contained in tabular form in ZCatalogs is often exactly the data site admins frequently want to export into some other format, such as CSV. This package provides views for exporting the catalog data into various formats.

Currently, only exporting the whole catalog with all metadata/brains/columns as CSV is supported. I plan to add support for submiting arbitrary index queries and for controlling the metadata/brains/columns exported.

Start with a catalog with some indexes and metadata/brains/columns and a few objects indexed.

>>> self.folder.manage_addProduct['ZCatalog'].manage_addZCatalog(
...     'catalog', 'Catalog')
>>> catalog = self.folder.catalog
>>> catalog.addIndex('id', 'FieldIndex')
>>> catalog.addIndex('title', 'FieldIndex')
>>> catalog.indexes()
['id', 'title']
>>> catalog.addColumn('meta_type')
>>> catalog.addColumn('id')
>>> self.folder.manage_addProduct['OFSP'].manage_addDTMLDocument(
...     'foo_doc', 'Foo Document')
>>> catalog.catalog_object(self.folder.foo_doc)
>>> self.folder.manage_addProduct['OFSP'].manage_addDTMLDocument(
...     'bar_doc', 'Bar Document')
>>> catalog.catalog_object(self.folder.bar_doc)
>>> [(brain.meta_type, for brain in catalog()]
[('DTML Document', 'foo_doc'), ('DTML Document', 'bar_doc')]

Open the export view in the browser specifying the export format as CSV.

>>> from Products.Five.testbrowser import Browser
>>> from Testing import ZopeTestCase
>>> self.setRoles(['Manager'])
>>> browser = Browser()
>>> browser.addHeader(
...     'Authorization', 'Basic %s:%s' %
...     (ZopeTestCase.user_name, ZopeTestCase.user_password))
>>> browser.handleErrors = False
...              '/export?Content-Type=text/csv')
>>> browser.isHtml
>>> print browser.headers
Status: 200 OK...
Content-Disposition: attachment...
Content-Type: text/csv...
>>> print browser.contents

XXX the testbrowser doesn’t handle use of response.write(). I’ve verified that this works in a real browser:

DTML Document,foo_doc
DTML Document,bar_doc


0.1 - 2008-11-14

  • Initial release
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.catalogexport-0.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting