Rocky, on 2007-04-22:
>
> On Apr 18, 6:17 pm, Martin Aspeli <[EMAIL PROTECTED]> wrote:
>> Come to think of it, Five's implementation of the <browser:page />
>> directive injects its BrowserView class as a base class of your class.
>> This is bad voodoo magic, though. It's going to happen. You need it. So
>> be explicit about it. :)
>
> Yes/no/maybe. I agree that this directive is probably doing more than
> it should be doing. But ... having the magical aq security machinery
> work is already fairly implicit in the zope2 world. I typically do
> "class MyView(object)" in order to treat it more like an adapter. How
> often do you extend conventional base classes when creating new non-
> view-style adapters? So in this case Five is injecting things for the
> view to behave better on Zope 2 (including allowing security to
> work). I don't know... I'm still fairly torn on this issue.
>
> In the meantime, either works.
Two thoughts after a conversation with Jean-Paul Ladage who had a
conversation with Daniel Nouri :)
1. context might need to be callable
2. Would it not be better if Five took care of all aq stuff, like
wrapping context in aq_inner?
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)
If this works than that is one thing less that programmers need to
worry about.
--
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
I can assure you mine are still greater."
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers