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


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

Reply via email to