On 08/10/2011 07:09 AM, Alan Elkner wrote:
Hey Justas,
I'm getting a strange error when I enter the url of
localhost:7080/gradebook/templates which should try to rneder the
index.html view of the IGradebookTemplates providing object. The
object is arrived at via two traversal adapters found in the
gradebook's configure.html. The registrations use the
adapterTraverserPlugin directive which does the adapter traversal
correctly as evidenced by the error message. However,
adapterTraverserPlugin probably doesn't set __parent__ on the adapted
context (please check this for me), so the exception occurs when, for
some reason, a viewlet is looking for the parent of the templates (see
backtrace).
An interesting case indeed. The fault was within
getGradebookTemplates adapter.
It was calling zope.container.contained.contained during traversal to
locate gradebook templates within GradebookRoot.
localhost:7080/gradebook/templates/index.html was faulty (not
implemented) and raised and exception, that consequentially reverted the
transaction and led to the error page; the error page could not be
rendered correctly, because templates.__parent__ was reset by reverted
transaction.
This is a good example why modifying essential objects while
traversing is not the best idea.
Also - zope.container.contained.contained is a helper method for
tests and does not fire containment events - please use it with caution,
or better - avoid it (I think I started using it first as a hack :/ ).
Anyway - fix committed, along with evolution script.
Cheers,
Justas
_______________________________________________
Mailing list: https://launchpad.net/~schooltool-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~schooltool-developers
More help : https://help.launchpad.net/ListHelp