[Framework-Team] Re: Body class

Hanno Schlichting hanno at hannosch.eu
Sun Jan 17 21:05:53 UTC 2010


On Sun, Jan 17, 2010 at 9:38 PM, Wichert Akkerman <wichert at wiggy.net> wrote:
> class MyView(BrowserView):
>    def __call__(self):
>        return aq_inner(self.context).some_template()
>
> and make sure that IViewView is set when some_template is rendered.
> Currently that is impossible since mark_view does checks that are impossible
> to influence from the outside, and there is nothing MyView could set
> IViewView on itself.

Right. I have to admit that I don't fully understand IViewView. It
currently suggests that for any published url, there's "one view"
representing this url and it can be marked as "the view of an object".

But our pages are composed of many views, with skins there aren't any
underlying views, though we somehow try to treat the ploneview as a
surrogate. Once you turn main_template into a browser page it becomes
even less clear what "the view" object is.

And as you noticed it's impossible to get to that one mysterious
"view" from somewhere in the layout stack. The only things you can
access from all places are context and request.

I think we might want to add a marker to the request instead or in
addition to the current approach, similar to how "disable editable
border" and "hide columns" work.

I had a similar use-case recently, where I needed to make some of the
content menus conditional on whether or not you are on "the folder
contents page". In the end I had to go down to something like
"alsoProvides(request, IContentsPage)" and check that in code in the
menus. The "view" just isn't accessible anywhere outside the one
template it is driving.

Hanno




More information about the Framework-Team mailing list