Ticket #11630 (closed Bug: fixed)

Opened 3 years ago

Last modified 22 months ago

Infite recursion in plone.i18n.normalize (__init__.py)

Reported by: Sardtok Owned by:
Priority: major Milestone: 4.x
Component: Internationalization Version: 4.0
Keywords: linguaplone Cc:

Description

After installing LinguaPlone it seems I can't create new content using Add New. It's possible to copy content and change it by manually renaming it through the contents page, but that means I can't add new types of content.

Versions: Plone - 4.0.2 plone.app.i18n - 2.0 plone.i18n - 2.0 LinguaPlone - 4.0.2

To me it seems that queryUtility returns the URLNormalizer from i18n/normalizer/init.py to its own normalize function: util = queryUtility(IURLNormalizer, name=locale) ... if util is not None:

text = util.normalize(text, locale=locale)

If util here is of the same class/the same object as the one normalize is first called on, it will just keep calling its own normalize over and over.

So it seems there's something wrong with queryUtility.

I've tried looking for this bug, but haven't found it here, or by googling, so I'm suspecting it might be some configuration or plug-in that screws up the queryUtility function.

Attachments

stacktrace.txt Download (2.6 KB) - added by Sardtok 3 years ago.
Stacktrace from trying to create a new page

Change History

Changed 3 years ago by Sardtok

Stacktrace from trying to create a new page

comment:1 Changed 3 years ago by vincentfretin

  • Owner vincentfretin deleted

comment:2 in reply to: ↑ description Changed 3 years ago by Sardtok

Changing all lines that read:

if util is not None

to:

if util is not None and util.__class__ is not self.__class__

will fix this bug. The problem of course is the base normalizer is returned when trying to get a normalizer for a language which doesn't have a specific normalizer. Therefore the base normalizer goes into an infinite loop creating new instances of base normalizers. Note that the test "util is not self", will not work due to new instances being created every time.

Note that all occurences should be changed, as some such tests affect file downloads and others publication. Some others again probably affect other areas.

comment:3 Changed 22 months ago by kleist

  • Keywords patch, linguaplone added
  • Status changed from new to confirmed
  • Version set to 4.0

comment:4 Changed 22 months ago by kleist

  • Keywords patch, removed

comment:5 Changed 22 months ago by kleist

  • Status changed from confirmed to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.