[Zope3-dev] Using parent references rather than context wrappers
to represent containment
Jim Fulton
jim at zope.com
Mon Aug 11 09:30:31 EDT 2003
Martijn Faassen wrote:
...
>>>To start out, I think that making containment not dependent on
>>>context wrappers is a good step that I support. I'll repeat my
>>>question on the role of 'context wrappers' after this change.
>>
>>They will only be used when you traverse to something that doesn't
>>implement IContained.
>
>
> Will these be the same as the decorators? I'm not clear on the difference
> between the decorators and the context wrappers; are they different?
ContainedProxy decorators are currently separate from ContextWrappers, but
they don't need to be. ContainedDecorators are used to persistencly
wrap objects stored in containers that don't, themselves, implement IContained.
Perhaps ContainedProxy objects could be used where context wrappers are used now.
>>>I'd
>>>like to see a summary of their remaining uses in the Zope 3 code base.
>>
>>Whenever we traverse to something during URL traversal, we would make
>>sure that the resulting object implemented IContained. If an object didn't
>>implement IContained directly, we'd add a context wrapper. At least, this
>>was
>>my plan. Perhaps we shouldn't do this. Perhaps I should try *not* doing
>>this
>>and see what happens. :)
>
>
> That sounds like a good thing to try.
One problem is that we use the context information to compute
absolute URLs and sometimes we do this for views. A view instances
otherwise has no way of knowing what name it was accessed with.
...
> Perhaps it would be useful to add another interface to make something
> context aware. IContained can be adapted to IContextAware. Views also
> implement IContextAware (but not IContained), and their behavior could then
> be to look for their 'context' attribute as their context.
Right. Unfortunately, we need more than context. We also need the
name. IContextAware could include the name.
> If something is not context aware at all, lookups simply fail.
I find this unacceptable for component lookup,
as context awareness should not be a prerequisite for using
the component architecture.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (703) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list