[Zope] How to override DTMLFile?
Tue, 27 May 2003 00:41:47 +0100
At 10:40 2003-05-23 -0400, Passin, Tom wrote:
>[ 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 -
> print 'This is "foo"'
>Class1.foo = foo
>obj = Class1()
># 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.
No that would be a hotfix on all instances of the DTMLFile class. Not what
I was after.
BTW, I've found my solution, but I guess I'll really need to inspect the
code to sort out the security stuff.
Will come back to the list for that probably.