Skip to content

Fix empty spaces in shortname#155

Open
daniele-andreotti wants to merge 13 commits into
masterfrom
us_73687
Open

Fix empty spaces in shortname#155
daniele-andreotti wants to merge 13 commits into
masterfrom
us_73687

Conversation

@daniele-andreotti
Copy link
Copy Markdown
Contributor

@daniele-andreotti daniele-andreotti commented Mar 31, 2026

Fix empty spaces in shortname when a content is created

@daniele-andreotti daniele-andreotti requested a review from cekk March 31, 2026 10:43
@daniele-andreotti daniele-andreotti self-assigned this Mar 31, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 31, 2026

Coverage Report for CI Build 26099796377

Coverage decreased (-0.2%) to 70.321%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 15 uncovered changes across 1 file (21 of 36 lines covered, 58.33%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/redturtle/volto/init.py 36 21 58.33%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2025
Covered Lines: 1424
Line Coverage: 70.32%
Coverage Strength: 1.41 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Member

@cekk cekk left a comment

Choose a reason for hiding this comment

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

And add a changelog and some tests please

self.request.response.setStatus(400)

msg = "Il nome breve non deve contenere spazi"
raise BadRequest(msg)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please use english as default, and translate it.

You don't need to set status and then raise the exception. BadRequest already set 400

data = json_body(self.request)

short_name = data.get("id", None)
if short_name and " " in short_name:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not use check_alias and improve it with also this check?

<plone:service
method="POST"
factory=".add.FolderPost"
for="Products.CMFCore.interfaces.IFolderish"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why only folderish? There are also non folderish contents.

Why not using an event handler instead of customizing a service?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should also work on edit/rename or not?

@daniele-andreotti daniele-andreotti changed the title Us 73687 Fix empty spaces in shortname Apr 8, 2026
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.

3 participants