Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

208 better reporting of failed exported objects #209

Merged
merged 6 commits into from
Jul 5, 2023

Conversation

flipmcf
Copy link
Contributor

@flipmcf flipmcf commented Jun 8, 2023

This adds a new form field on @@export_content "write_errors" which turns on a list of unexported paths at the end of a json export.

When 'write_errors' is set to a true value, the export appends the list like so:

[{
    "@id": "http://localhost:8081/RFA/english/item1",
    "@type": "news_item",
    "UID": "34b9faa0dbe648b6826174abc4ff85c1",
    ... <snip>
},
{
    "@id": "http://localhost:8081/RFA/english/item2",
    "@type": "news_item",
    "UID": "34b9faa0dbe648b6826174abc4ff85c2",
    ... <snip>
},{
    "@id": "http://localhost:8081/RFA/english/item3",
    "@type": "news_item",
    "UID": "34b9faa0dbe648b6826174abc4ff85c3",
    ... <snip>
},{
    "unexported_paths": [
        {
            "path": "http://localhost:8081/RFA/english/news/story-slideshow-05232023120021.html",
            "message": "Error exporting http://localhost:8081/RFA/english/news/story-slideshow-05232023120021.html"
        }
    ]
}]

Additionally, some log messages were converted to 'f' strings to "leave it better than you found it" and error logs now show number of errors or 'skipped objects' during export:

2023-06-08 13:55:06,216 INFO    [collective.exportimport.export_content:237][waitress-0] Exported 50 ['Image', 'Kaltura Video', 'press release', 'raw html', 'section', 'Slideshow', 'story', 'subsite', 'testipublication', 'chair'] with 1 errors

@flipmcf flipmcf linked an issue Jun 8, 2023 that may be closed by this pull request
@flipmcf flipmcf requested a review from pbauer June 8, 2023 18:06
@flipmcf
Copy link
Contributor Author

flipmcf commented Jun 8, 2023

failing the py27 tests.... I guess the whole "hey, these can be f-strings!" idea wasn't so good after all.

Copy link
Member

@pbauer pbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I'll give it a try later today

@pbauer pbauer merged commit 5f035a6 into main Jul 5, 2023
11 checks passed
@pbauer pbauer deleted the 208-better-reporting-of-failed-exported-objects branch July 5, 2023 12:00
@flipmcf
Copy link
Contributor Author

flipmcf commented Jul 14, 2023

Thank you!

I'm not satisfied because it (probably) generates a export that is not importable back into plone - if errors occur.
I haven't tested importing back into plone if the error dictionary with "unexported_paths" exists at the end.

But maybe we like making exports with errors fail on import - because it stops the import and the user must face the fact that some objects didn't export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better Reporting of Failed Exported Objects
2 participants