Ticket #8260 (closed Bug: duplicate)

Opened 7 years ago

Last modified 6 years ago

plone.app.redirector stores an entry for every object

Reported by: diefenbach Owned by: optilude
Priority: minor Milestone: 3.1.3
Component: General Version:
Keywords: Cc:


plone.app.redirector (1.0.7) stores an entry for every newly created object.

Whenever an object is created it seems that the "IObjectMovedEvent" is sent (due to the renaming from the default id to the normalized title?), hence the subscriber "objectMoved" of plone.app.redirector is called. It is true that there is a check whether the old object is within portal_factory but for any reason the old path doesn't include portal_factory in its path and so the entry is created.

Change History

comment:1 Changed 7 years ago by witsch

(In [21391]) add test to check for creation of redirection entries for new object ?\226?\128?\148 this one works, i.e. no entry gets created, but perhaps things are different ttw... (see #8260)

comment:2 Changed 7 years ago by witsch

(In [21392]) add another test to check for creation of redirection entries for new object ?\226?\128?\148 now ttw, and this time it does indeed fail... (see #8260)

comment:3 Changed 7 years ago by witsch

(In [21393]) suggested fix for preventing the creation of a redirection entry for newly created objects (see #8260)

comment:4 Changed 7 years ago by witsch

  • Owner changed from witsch to optilude

plone.app.redirector is actually optilude's turf, but i've added a test and suggested fix nevertheless. imho, the check should suffice, but could propbably still extended like

# Special case: don't remember object when it was just created...
putils = getToolByName(obj, 'plone_utils')
if hasattr(aq_base(obj), 'checkCreationFlag') and \
        obj.checkCreationFlag() is False and \
        putils.isIDAutoGenerated(event.oldName) and \
        obj.generateNewId() == event.newName:

to make absolutely sure it doesn't skip creation of an actually needed entry...

martin, please review & revert/fix as you deem necessary...

comment:5 Changed 7 years ago by wichert

  • Status changed from new to closed
  • Resolution set to duplicate

This is a duplicate of #7278

comment:6 Changed 7 years ago by witsch

(In [21458]) unfortunaly, the fix in r21393 was mislead by a  wrong docstring for archetypes' checkCreationFlag method: it does return True as long as the object hasn't been fully saved. so as it turns out unmarkCreationFlag gets called before our subscriber, making it impossible to use the creation flag to differentiate renames for newly created objects from regular ones...

now the request url is checked instead ?\226?\128?\148 that's not exactly elegant, but neither martin nor i could think of a better check and well, it works (also see #8260).

comment:7 Changed 6 years ago by hannosch

  • Component changed from Linkintegrity to Infrastructure

comment:8 Changed 3 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.