Skip to content

Do not fail exporting content whose language is null - #105

Merged
ericof merged 1 commit into
plone:mainfrom
kunalKumar-13:issue-95-export-content-without-language
Oct 1, 2026
Merged

ericof merged 1 commit into
plone:mainfrom
kunalKumar-13:issue-95-export-content-without-language

Conversation

@kunalKumar-13

Copy link
Copy Markdown
Contributor

Fixes #95.

fix_language reads the serialized language with item.get("language", {}). The
default only applies when the key is absent, and content without a language
serializes to "language": null — so the key is there holding None, and the
following .get("token", ...) raises
AttributeError: 'NoneType' object has no attribute 'get'. Exporting a site with
content in the language independent folder, like classic.demo.plone.org, stops
there.

A language of None is now treated the same as a missing language: the item gets
PLACEHOLDERS_LANGUAGE, and deciding on a real language is left to the import,
where the parent is known — which is what you asked for in the issue. None is
mapped explicitly rather than with or {} so that "" keeps taking the string
branch it takes today.

Tests

  • a {"language": None} row in the existing test_fix_language table;
  • an export of a real content item whose language has been set to None,
    asserting the written data.json carries the placeholder — this is the path
    from your traceback.

tests/utils + tests/exporters go from 176 to 178 passing. The whole suite
goes from 227 to 229 passing with the same 15 failures and 8 errors before and
after; those are pre-existing and come from test ordering — tests/utils on its
own is 101 passing on an unmodified checkout. Reverting only
export_helpers.py and keeping the tests fails exactly the two new cases.

fix_language read the serialized language with item.get("language", {}). The
default only applies when the key is absent, and content without a language
serializes to "language": null, so the key is there holding None and the
following .get("token", ...) raised AttributeError: 'NoneType' object has no
attribute 'get'. Exporting a site with content in the language independent
folder, such as classic.demo.plone.org, stopped there.

A language of None is now treated the same as a missing language: the item gets
the default-language placeholder, and deciding on a real language is left to
the import, where the parent is known.

Two tests: a case in the existing test_fix_language table, and an export of a
real content item whose language has been set to None, asserting the exported
data.json carries the placeholder.

Measured with pytest and the Plone 6.2-dev constraints: tests/utils and
tests/exporters went from 176 to 178 passing. The whole suite went from 227 to
229 passing with the same 15 failures and 8 errors before and after; those are
pre-existing and come from test ordering, since tests/utils on its own is 101
passing on an unmodified checkout. Reverting only export_helpers.py and keeping
the tests fails exactly the two new cases.

Fixes plone#95
@mister-roboto

Copy link
Copy Markdown

@kunalKumar-13 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@kunalKumar-13

Copy link
Copy Markdown
Contributor Author

@jenkins-plone-org please run jobs

1 similar comment
@kunalKumar-13

Copy link
Copy Markdown
Contributor Author

@jenkins-plone-org please run jobs

@kunalKumar-13

Copy link
Copy Markdown
Contributor Author

The Jenkins jobs here have been pending since 5 September — stuck rather than failing, as far as I can tell; the other checks are green and the branch is mergeable.

@jenkins-plone-org please run jobs

@kunalKumar-13

Copy link
Copy Markdown
Contributor Author

Jenkins has reported since my nudge, and some jobs are red. They are the acceptance layer timing out on browser startup, not this change — the logs are full of TimeoutError: page.goto and Tried to take screenshot, but no page was open, in Robot suites like plone.app.multilingual's Test Add Translation.

It is not specific to this PR: the same signature appears on the other branches I nudged today, and plone.restapi#2021 by @sneridagh is currently 4/4 red with it while other PRs pass. Some runs hold and some do not.

Owning the part that is mine: these jobs had been pending since early September and I asked Jenkins to run them, which turned no signal into some red. The red is the browser layer rather than the change, but it appeared because I nudged. Full breakdown in plone/plone.restapi#2046 if useful — 9,778 tests, 4 failures, all in Playwright suites.

@kunalKumar-13

Copy link
Copy Markdown
Contributor Author

The red Jenkins jobs are infrastructure, not this PR. Build
#299 ran on NodeKombinat
and logs Could not connect to the playwright process at 127.0.0.1:<port> 82 times —
the browser sessions never come up, so the robot suites cannot run.

That node also turns out to be missing a Chromium revision the 6.0 line needs, which I
have written up as plone/plone.jenkins_node#21 with the per-build evidence. I am less certain
the connect failures share that root cause, so I flagged them separately there rather
than asserting it. Nothing in this PR is browser-related.

@ericof

ericof commented Sep 25, 2026

Copy link
Copy Markdown
Member

@jenkins-plone-org please run jobs

@ericof
ericof merged commit d3fab82 into plone:main Oct 1, 2026
6 checks passed
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.

Cannot export content from LIF where language is None

3 participants