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" Then from somewhere else I do:: manage_edit = PeterDTMLFile('dtml/manage_edit', globals()) This works but doing <dtml-var foo> raises a KeyError. I've looked at Localizer and how they override DTMLFile's __init__ and _exec method. But if I try to do:: # pointless inheritance hack but for testing class PeterDTMLFile(DTMLFile): def __init__(self, name, _prefix=None, **kw): apply(DTMLFile.inheritedAttribute('__init__'), (self, name, _prefix), kw) Which in effect is pretty pointless, I get the following error when trying my manage_edit:: Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 62, in mapply AttributeError: 'None' object has no attribute 'co_varnames' So, can anybody tell me how to override the DTMLFile class (and possible also the PageTemplateFile) Grateful, Peter