Ticket #8260 (closed Bug: duplicate)
plone.app.redirector stores an entry for every object
| Reported by: | diefenbach | Owned by: | optilude |
|---|---|---|---|
| Priority: | minor | Milestone: | 3.1.3 |
| Component: | Infrastructure | Keywords: | |
| Cc: |
Description
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:4 Changed 4 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: return
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 4 years ago by wichert
- Status changed from new to closed
- Resolution set to duplicate
This is a duplicate of #7278
comment:6 Changed 4 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).

(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)