plone / plone/plone.exportimport

obj can be None, but not checked.

Open Beginner friendly
#91 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

01 type: bug
Dominant language
Python
Stars
2
Forks
3
Avg merge
21h 16m
Merged PRs (30d)
1

Description

The result of unrestrictedTraverse might be None. But the code does not check it. If for some reason the path is wrong the code fails:

https://github.com/plone/plone.exportimport/blob/cfeccda15412ac2684a91cea14a27547af3e136e/src/plone/exportimport/utils/content/core.py#L62-L64

2026-04-20 14:27:38,634 ERROR   [Zope.SiteErrorLog:35][waitress-3] MissingParameterError: http://localhost:8080/@sites
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 390, in publish_module
  Module ZPublisher.WSGIPublisher, line 284, in publish
  Module ZPublisher.mapply, line 98, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module plone.rest.service, line 21, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.distribution.services.sites.add, line 49, in reply
  Module plone.distribution.api.site, line 165, in create
  Module plone.distribution.api.site, line 104, in _create_site
  Module plone.distribution.handler, line 44, in default_handler
  Module plone.exportimport.importers, line 59, in import_site
  Module plone.exportimport.importers.content, line 204, in import_data
  Module plone.exportimport.importers.base, line 88, in import_data
  Module plone.exportimport.importers.content, line 164, in do_import
  Module plone.exportimport.utils.content.import_helpers, line 333, in set_ordering
  Module plone.exportimport.utils.content.core, line 64, in object_from_uid_or_path
  Module decorator, line 235, in fun
  Module plone.api.validation, line 67, in wrapped
plone.api.exc.MissingParameterError: Missing required parameter(s): obj

In the other failure path the function returns None - this should be the case here too.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/plone/exportimport/utils/content/core.py at object_from_uid_or_path, especially lines 62–64, and compare the other failure path in that function. Verify that an invalid path returns None like the other path and no longer raises MissingParameterError during content import.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.