collective / collective.logbook

Advanced exception logging for Plone
5 stars 2 forks source link

Cannot handle traceback when error occurs when accessing a method of a view #19

Closed rafaelbco closed 4 years ago

rafaelbco commented 4 years ago

This failure occurs in a very specific situation: when accessing a view's method directly via its URL, eg.: http://127.0.0.1:8080/Plone/@@my-view/my_method

In order to get the context of the raised error the events.handleTraceback() method gets the aq_parent of the error_log object, which is the current "published" object in Zope-speak. When accessing a view normally, i.e http://127.0.0.1:8080/Plone/@@my-view, the published object is the context of the view (the Plone site root in the given example).

However, when accessing the method of a view the published object is the view itself (@@my-view in the example). In this case collective.logbook fails because the view instance is not pickable.