[z3-five] BrowserView and AttributeError on getPhysicalPath
Tim Hicks
tim at sitefusion.co.uk
Wed Jul 12 23:41:48 CEST 2006
Rob Miller wrote:
> On Wed, 12 Jul 2006 15:07:42 +0100, Tim Hicks wrote:
>> Hi,
>>
>> I have a view.py module that looks like:
>>
>> # Five imports
>> from Products.Five import BrowserView from
>> Products.Five.browser.pagetemplatefile \
>> import ZopeTwoPageTemplateFile as PageTemplateFile
>>
>>
>> class TopicView(BrowserView):
>> """
>> """
>>
>> topic_listing = PageTemplateFile('./topic_listing.pt')
>> author_listing = PageTemplateFile('./author_listing.pt') topic_view
>> = PageTemplateFile('./topic_view.pt')
>>
>>
>> I have a ZCML snippet that looks like:
>>
>> <browser:page
>> for=".interfaces.IWeblog"
>> class=".browser.view.TopicView"
>> attribute="topic_listing"
>> permission="zope2.View"
>> name="topics" />
>
> i don't know what, exactly, is causing your error, but to accomplish the
> same result i'd usually just use the "template" attribute on the
> browser:page directive rather than using attribute. then you can remove
> the attributes from the view class.
>
> this may not fix your problem, but it's worth trying, anyway.
Hi Rob,
Yeah, using the "template" attribute does fix the problem. The reason I
was trying to put things in a custom view class were twofold:
1. I was under the impression that this is somehow more correct;
2. I was actually trying to debug a separate issue with my traversal
and view code, and wanted to have a bit more control over the view class
to help with tracking that down. I feel a separate email to this list
coming on discussing that issue, though.
Once I hit this getPhysicalPath error, I figured that something wasn't
right, and that I should try to track down the problem anyway.
Has anyone else got view-ish templates working successfully with Plone?
(I have had them working in the past, but am not sure what has changed.)
Thanks,
Tim
More information about the z3-five
mailing list