[Zope3-Users] Using a ZPTPage with a View Class

Gary Poster gary at zope.com
Wed Oct 12 09:45:05 EDT 2005


On Oct 9, 2005, at 8:36 PM, Wade Leftwich wrote:
...
> My general question is, is this a reasonable way to proceed? It  
> works OK  with Benji York's Hello World example; in particular the  
> 'view' and 'context' namespaces seem to be complete. But Hello  
> World doesn't exercise the code much. Is there another pattern I  
> should be using instead? Have I overlooked a perfectly good  
> solution that's already out there?

Hey Wade.  Is your use case that you want to be able to develop the  
page templates TTW and then easily drop them down to the file system  
without change?  Seems like it would do the trick.

There are other possible approaches depending on your use cases and  
on who is supposed to use the system, and I believe the desired way  
to do this sort of thing in the future is probably to have a  
persistent adapter registry that could look up views created and  
configured through the web.

It's a shame that you have to use a named adapter since the  
interfaces are the same, but it is a reasonable workaround for now.   
It's also a shame that the adapter has to subclass the ZPTPage class  
just to get the namespace lookup code, but that's also understandable.

Another approach might be to actually create a TTW ZPTPage template  
that constructs the namespace as expected by a filesystem based  
template.  I'm not sure why it doesn't work that way no, but I can  
guess.  In any case, that would mean your view could do less work.

Gary


More information about the Zope3-users mailing list