[Zope3-Users] Weird behaviour of ViewPageTemplateFile()

Jim Fulton jim at zope.com
Thu Apr 10 14:28:22 EDT 2008


On Apr 10, 2008, at 10:30 AM, Marius Gedminas wrote:
>
>>  I've got a view defined in a configure.zcml that points to this  
>> class:
>>
>>    class MyView(BrowserView):
>>        def __call__(self):
>>            self.pt = ViewPageTemplateFile('empty.pt')
>>            data = self.pt()
>>            return data
>>
>>  That works fine.
>
> I'm actually surprised that this works.


It works because, unlike regular objects, ExtensionClass instances  
call descriptors when you get a descriptor as an attribute.  This is  
for backward compatibility with __of__ methods (which become __get__  
methods).

Jim


--
Jim Fulton
Zope Corporation




More information about the Zope3-users mailing list