plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
246 stars 187 forks source link

Can't set capital letters in an ID #2450

Open cdw9 opened 6 years ago

cdw9 commented 6 years ago

Tested in Plone 5.0 and 5.1

What I did:

Added a new folder. In the settings tab, I set the Short name to Test, with a capital T. After saving, the id is test. I click Actions > Rename, and enter Test again. Now the folder has the id test-1.

What I expect to happen:

I expect this to keep the capital letters in the ID.

Reasoning:

I'm guessing this change was on purpose, and I agree that urls should be all lowercase. But here is my use case:

I'm working in a migrated site, and the folders created in the migration use capital letters, as they did in the original site. I don't always want to run a full migration to test a specific page, so sometimes I'll add the folders in the path manually. But if I can't create the folders TTW with the capital letters, I have to take extra steps to test the migration for an item that is 5 levels deep in the site.

gforcada commented 6 years ago

Assuming you are migrating to Dexterity

Could this actually be turned into a behavior? :thinking:

jensens commented 6 years ago

Overall, I do not think its a bug. It's a feature doing things different than you expect them. The normalization and name-choosing is always lower-casing. Usually this is good.

The only part I consider a bug is, on second rename a -1 is chosen. This is probably wrong.

I agree, this could be handled different. While derivation of an ID from from title all is fine. If an ID is explicitly set using a form, it could be taken literally if it is an allowed Zope ID and not conflicting with existing IDs and templates names etc.

davisagli commented 6 years ago

URL normalization is handled by an adapter so it should be fairly straightforward to override. I can imagine that different sites might want different policy about how strictly to enforce the normalization.

tomgross commented 6 years ago

It is also possible to keep the ids as they are and register a custom case insensitive zope.traversing.interfaces.ITraversable adapter.

terapyon commented 5 years ago

@davisagli I want to use capital letters in an ID too. Please let me know how to override the normalizer.

terapyon commented 5 years ago

I found the normalizer. https://github.com/plone/plone.i18n/blob/master/plone/i18n/normalizer/__init__.py#L153 I will try to override the method.