Maurits van Rees-3 wrote:
>
> Rocky, on 2007-04-22:
> Two thoughts after a conversation with Jean-Paul Ladage who had a
> conversation with Daniel Nouri :)
>
> 1. context might need to be callable
>
Context needs to be the context content object. I don't see any requirement
that it should be callable. But IBrowserView (or rather, things it derives
from) specifies that 'context' is the object (and not a list as in the
CMFPlone.utils.BrowserView base class)
> 2. Would it not be better if Five took care of all aq stuff, like
> wrapping context in aq_inner?
>
It can't. No matter what you put in self.context, the wrapping happens on
*retrieval* so if self inherits from Acquisition.Explicit, when you do
self.context you get back context aq-wrapped in self.
> Combining these two thoughts in Five/browser/__init__.py :
>
> from Acquisition import aq_inner
> class BrowserView(Acquisition.Explicit,
> zope.app.publisher.browser.BrowserView):
> """Five browser view
>
> Mixes in explicit acquisition so that security can be acquired for
> views"""
>
> def __init__(self, context, request):
> self._context = context
> self.request = request
>
> @property
> def context(self):
> return aq_inner(self._context)
>
Unfortunately, acquisition doesn't work properly inside Python property
__get__ accessors. I've seen this pattern before, but I've seen people have
various problems with it (that I can't remember the details of right now).
Martin
--
View this message in context:
http://www.nabble.com/Browser-views%3A-inherit-from-object-or-BrowserView-from-Five-Plone-tf3601148s20094.html#a10143880
Sent from the Product Developers mailing list archive at Nabble.com.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers