RE: [Zope] How to override DTMLFile?
[ Peter Bengtsson]
I want to override DTMLFile from Globals in my own special product. I managed to do this::
class PeterDTMLFile(DTMLFile): def foo(self): return "works"
I have not tried it in Zope, but it seems to me that you ought be be able to create new class methods just by assignment to the class (outside of the class definition). This works with normal Python classes, but I do not know how far a DTMLFile class differs from a normal class, nor how restricted product code might be compared with normal Python code. Here is an example - class Class1: pass def foo(self): print 'This is "foo"' Class1.foo = foo obj = Class1() obj.foo() # prints This is "foo" Of course, this would affect all instances of DTMLFile and I am not clear if you really intend that or not. Cheers, Tom P
participants (1)
-
Passin, Tom