Re: [Zope3-dev] wading through zcml...

2006-11-16 Thread Chris Withers

Martin Aspeli wrote:


Chris Withers wrote:
What's the difference between zope:view, browser:view, browser:page and 
browser:viewlet?



I would strongly encourage you to buy Philipp's book when the second edition
comes out, and read some of the available existing documents (e.g.
worldcookery.com, the Zope 3 wiki thingie).


I'm a strong reader of Philipp's book(s) but they don't go into enough 
detail here...



 is deprecated, I believe, an old spelling for 
before  could do multi-adapters.


See my previous complaint, they have totally different signatures, I 
don't see how one can be deprecated in favour of the other.



 is about registering a new view, typically one that doesn't
render a page (so think of it analogous to where you may use a Script
(Python) in Zope 2)


What's the difference between a page and not a page in your mind?


 is about a view typically with an associated template that
renders something for the user


Then why is the macros view in the following example registered as a page:
http://wiki.zope.org/zope3/SimplifyMacroRegistration
?


 is about building viewlets, which are small chunks of
HTML that are aggregated into a . The DocTest in
zope.viewlet explains it all.


Sounds like this is worth a look...

I'm trying to register an adapter in such a way that I can do the 
following in a page template:





You would use a browser:view with a class deriving from BrowserView
(Products.Five.browser.BrowserView)


Why do I need to subclass BrowserView? I looked through the code and 
can't really see what this adds...


As I've said before, I don't care about the request, and really don't 
like the magic appearance of both the request and context attributes. 
That said, looking at the actual object I appear to get as the view, I'm 
deeply scared to see so much magic going on (wtf is a 
Products.Five.metaclass?!)



and did its magic in the __call__ method
i believe. A more common pattern would be to have a method on the view
"render" that you call:

tal:define="renderView someobj/@@render"
tal:content="structure renderView/renderTheData"


This all feels way to heavyweight. My IRender has exactly one method, 
and a lot of objects will be getting rendered on each page...


Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] wading through zcml...

2006-11-16 Thread Martin Aspeli



Chris Withers wrote:
> 
> What's the difference between zope:view, browser:view, browser:page and 
> browser:viewlet?
> 

I would strongly encourage you to buy Philipp's book when the second edition
comes out, and read some of the available existing documents (e.g.
worldcookery.com, the Zope 3 wiki thingie).

 is deprecated, I believe, an old spelling for 
before  could do multi-adapters.

 is about registering a new view, typically one that doesn't
render a page (so think of it analogous to where you may use a Script
(Python) in Zope 2)

 is about a view typically with an associated template that
renders something for the user

 is about building viewlets, which are small chunks of
HTML that are aggregated into a . The DocTest in
zope.viewlet explains it all.



> I'm trying to register an adapter in such a way that I can do the 
> following in a page template:
> 
> 
> 

You would use a browser:view with a class deriving from BrowserView
(Products.Five.browser.BrowserView) and did its magic in the __call__ method
i believe. A more common pattern would be to have a method on the view
"render" that you call:

tal:define="renderView someobj/@@render"
tal:content="structure renderView/renderTheData"



> Also, why, when zope:view is described as a synonym for zope:adapter, 
> does zope:view support an allowed_attributes attribute, while 
> zope:adapter does not?
> 

It has to do with the fact that in the olden days, there were no
multi-adapters, and views were special. Then they realised that a view was
in a fact a multi-adapter on context, request, and that this was a more
generally useful pattern.

Martin

-- 
View this message in context: 
http://www.nabble.com/wading-through-zcml...-tf2641986.html#a7376076
Sent from the Zope3 - dev mailing list archive at Nabble.com.

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] wading through zcml...

2006-11-16 Thread Chris Withers
What's the difference between zope:view, browser:view, browser:page and 
browser:viewlet?


I'm trying to register an adapter in such a way that I can do the 
following in a page template:




Which of the myriad flavours of view registration should I be using?

Also, why, when zope:view is described as a synonym for zope:adapter, 
does zope:view support an allowed_attributes attribute, while 
zope:adapter does not?


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com