On Oct 12, 2005, at 9:45 AM, Gary Poster wrote:


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.

Hello Gary,

The general use case is that we want to drop a TTW Page Template into a container and have all the instances of filesystem Content Type Foo that are in that container use it for a View. I tried passing keyword args to the existing ZPTPage class's __call__ method, but no joy.


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.

That does sound like the hot setup.


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.

It seems to be working OK so far. Thanks for the reassurance that I was not missing something obvious.


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.

I actually started to create a new ViewPageTemplateTTW class to parallel ViewPageTemplateFile, but for now I want to be able to use existing TTW templates. Besides, adapters are new and different and fun.


Gary



Thanks --

Wade






_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to