collective / collective.transmogrifier

A configurable pipeline, aimed at transforming content for import and export
Other
5 stars 8 forks source link

Add info during processing, easing e.g. tarball download support #8

Open tobiasherp opened 9 years ago

tobiasherp commented 9 years ago

This pull request includes the format changes of issue #7 (I like to rectify the format first before applying meaningful changes in a separate step) but mainly addresses #6, a way to accumulate information during processing. My use case is the download of a generated tarball; but there could be more. Thus I don't propose a special change for tarballs only; it is supposed to be helpful for different purposes.

Currently there is no way to get the export context (which was created by some section of a pipeline), e.g. to offer to download it; the Generic setup tool creates the context itself (and is supposed to have quintagroup.transmogrifer use it somehow when exporting the site content, but this doesn't work for me). However, transmogrifier sections can create export contexts themselves, and we should be able to access them in a standard way. (Currently they are completely hidden from the calling code, and not even accessible via the transmogrifier object afterwards.)

The idea is to fill a list of information chunks; along with the information itself, there is a category (e.g. export_context) and the name of the session which added it. Thus, it is possible to easily get all information added by a certain session, or of a certain category. When producing a tarball for download, we could iterate over "all" information of the export_context type (there will be typically exactly one) and return a response which contains the tarball easily. (If the tarball has not been created, we could easily redirect to a page and display error messages instead.)

Other use cases could be detailed information about some in-site processing (e.g. encoding fixed for 753 of 29384 objects), or about imported objects.