Custom exporter logic - #2101
Conversation
|
@gforcada would you please request a review from whoever can provide a technical review? I've already requested two folks, based on the linked PR and the related training author. |
|
@stevepiercy thanks for doing that, I will try to remember next time. I will add another one, just to have higher chances of one actually reviewing it |
|
I'll do an editorial review, after the technical parts are verified. Thanks for your collaboration. |
davisagli
left a comment
There was a problem hiding this comment.
This looks accurate for the proposed implementation in plone/plone.exportimport#86, but I also asked a question there to confirm whether @gforcada has confirmed this does what he needs.
|
|
||
| There are other scenarios where a custom data export makes sense: | ||
|
|
||
| - sensible content should not be exported |
There was a problem hiding this comment.
| - sensible content should not be exported | |
| - sensitive content should not be exported |
"sensible" means "it makes sense"
"sensitive" means "delicate" or "secret"
| self.obj = obj | ||
| self.errors = None | ||
|
|
||
| def get_objects(self, query, errors) -> Generator: |
|
|
||
| For that, you can _override_ the `plone.exportimport.interfaces.IObjectsExporter` adapter. | ||
|
|
||
| On `overrides.zcml` add: |
There was a problem hiding this comment.
| On `overrides.zcml` add: | |
| In {file}`overrides.zcml` add: |
| /> | ||
| ``` | ||
|
|
||
| On `my.package.adapters.py` add: |
There was a problem hiding this comment.
| On `my.package.adapters.py` add: | |
| In {file}`my.package.adapters.py` add: |
| With this, the default `plone-exporter` will no longer export **all content**. | ||
|
|
||
| ```{warning} | ||
| As soon as you override the export be aware that other parts of the export might not work. |
There was a problem hiding this comment.
I was more worried about whether the import works. For example if 10% of content is exported by the content step but 100% of relations are exported by the relations step, then the import might fail when there is a relation that refers to one of the content items that was not included. Can you at least do a sanity check that this works in your case?
| # custom logic to select which specific content gets exported | ||
| ``` | ||
|
|
||
| With this, the default `plone-exporter` will no longer export **all content**. |
There was a problem hiding this comment.
That's a bit of a limitation. Maybe you want all of the content sometimes, and different subsets at other times. This makes me wonder whether we should have named IObjectsExporter adapters, and make it possible to specify which one to use in the CLI
Description
This is part of plone/plone.exportimport#86
Where an easy way to customize the default content exporter is added.