smcmahon/Products.PloneFormGen — Issue #18: BadRequest after adding a new thanks page if link integrity checking is enabled
Author: datakurre
Created: 2011-11-23 09:18:56+00:00
State: open

It would be nice, if someone could confirm this:

1. enable link integricy checking on your site
2. add new form folder
3. add new thanks page onto that folder
4. get this

```python
Traceback (innermost last):

Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFPlone.FactoryTool, line 438, in __call__
Module Products.CMFPlone.FactoryTool, line 202, in __getitem__
Module Products.CMFPlone.FactoryTool, line 68, in _createObjectByType
Module Products.CMFCore.TypesTool, line 560, in _constructInstance
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module plone.app.linkintegrity.handlers, line 83, in modifiedArchetype
Module plone.app.linkintegrity.handlers, line 57, in getObjectsFromLinks
Module plone.app.linkintegrity.handlers, line 34, in findObject
Module OFS.Traversable, line 256, in unrestrictedTraverse
__traceback_info__: ([], '.')
Module Products.CMFPlone.FactoryTool, line 202, in __getitem__
Module Products.CMFPlone.FactoryTool, line 68, in _createObjectByType
Module Products.CMFCore.TypesTool, line 554, in _constructInstance
Module Products.PloneFormGen.content.thanksPage, line 4, in addFormThanksPage
Module OFS.ObjectManager, line 323, in _setObject
Module Products.CMFCore.PortalFolder, line 313, in _checkId
Module OFS.ObjectManager, line 98, in checkValidId
BadRequest: The id "." is invalid because it is not traversable.
```

* `Products. PloneFormGen == 1.7.0`
* `plone.app.linkintegrity == 1.4.4`

What happens

1. `plone.app.linkintegrity.handlers.modifiedArchetype` gets fired by `zope.lifecycleevent.IObjectCreatedEvent` for new thanks page still under *portal factory*
2. it founds `visit the form` from `noSubmitMessage`
3. it tries to traverse `.` under *portal factory*
4. triggering it to try to create a yet another thanks page with id `.` (and failing)

If this can be confirmed, a quick fix would be to modify the default `noSubmitMessage` to be linkintegrity-safe, but eventually, I think, this should be fixed in plone.app.linkintegrity (I wonder, why it subscribes IObjectCreatedEvent for Archetypes instead of IObjectInitializedEvent).