[Grok-dev] context in grok.Annotation

Martijn Faassen faassen at startifact.com
Wed Jan 14 13:09:54 EST 2009


Jan-Wijbrand Kolman wrote:
> Is there a reason why a grok.Annotation component does not have a
> context passed into its __init__? It would be trivial to implement and
> in certain cases very useful to be able to get to the context within
> the annotation. Or does this have persistence repercussions?

It would become a circular reference, but I guess that isn't a problem 
as we got plenty of those with __parent__ already.

> Another aproach would be to have the grok.Annotation component
> subclass zope.app.container.contained.Contained (or just have it
> implement ILocation) so that within the annotations you have access to
> the __parent__ attribute (being the context).

This might be worthwhile perhaps in addition to the above (ILocation, 
not contained, I think), so that one can have URLs for annotations. It 
needs more thinking though - how is one to traverse to such an 
annotation? The whole idea of an annotation after all is that it is 
separate from the class it is annotating, so having a property on the 
class sort of defeats the purpose. Also what would be the name?

I think this issue is separate from the context issue, though.



More information about the Grok-dev mailing list