Importing a CV: an importer plugin that raises in can_handle breaks the page for every file, Europass included #611
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#611
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, reading the import view against the registry's handling of capture sources and trying it against the test settings.Related to #105.
Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atplugins/registry.py:344-369(parse_page, the comparison);resume/views.py:441-461andplugins/registry.py:274-284have not moved.The import page asks each installed importer
can_handle()in turn. Third-party importers are asked first and the built-in Europass importer last. OnlyImportRefusedis caught. Capture sources get atry/exceptthat logs the failing plugin and moves on (registry.parse_page); importers do not, so the project's rule that a plugin that raises is logged and skipped does not hold on this page.resume/views.py:441-461(EuropassImportView.post: the generator callingplugin.can_handle(data, upload.name or ""), thenimporter.read(data), insidetry: … except base.ImportRefused);plugins/registry.py:274-284(plugins(): third-party first); compareplugins/registry.py:362-386(parse_page).can_handleraises on bytes it did not expect, for example a PDF. Tried on the test settings with a double that raisesValueError: posting a Europass file toresume:europass_importanswered 500. From then on every upload on the page fails, because the built-in importer is only asked after the faulty one. An unexpected exception fromread()also ends in a 500, where the page could name the importer that failed.can_handleintry/except Exceptionwithlogger.exception(...)and continue to the next importer, asparse_pagedoes. Wrapread()the same way, and show the person a sentence naming the importer that failed instead of a server error. Update the importer section of the wiki's Writing a plugin ("Any other exception is a bug in the importer and is reported as one") to say what the person sees.Done when
tests/test_importers.pyregisters an importer whosecan_handleraises ahead of Europass and shows a Europass file still being read, with the failure logged; a second test, withread()raising, shows a message on the page instead of a 500.