On Thu, Jan 27, 2005 at 09:59:17PM -0600, Keith Alperin wrote:
Greetings Zopistas!
I have been a Zope tinkerer for a few years and have never been able to adequately solve this problem: When I create a Product class with DTML/ZPT methods, how can I make those methods members of the class rather than simply instance methods? These examples should illustrate what I mean.
I feel like I must be misunderstanding the question. Your examples are so odd, you must be trying to do something unusual ;-) But if you're asking what I think you're asking, just do what nearly ever other zope Product on the planet does: class Foo(SimpleItem): my_method1 = DTMLFile('dtml/my_method', globals()) my_method2 = PageTemplateFile('zpt/my_other_method', globals()) In other words, set them as class attributes, not within another method. And to secure them, do this: class Foo2(SimpleItem): security = AccessControl.classSecurityInfo() security.declareProtected('Some Permission', 'method1') method1 = PageTemplateFile('zpt/method1', globals()) security.declarePrivate('method2') method2 = PageTemplateFile('zpt/method1', globals()) security.declarePublic('method3') method3 = PageTemplateFile('zpt/method3', globals()) -- Paul Winkler http://www.slinkp.com