[Zope] Calling DTMLFile from an external method

Joachim Schmitz js@aixtraware.de
Tue, 29 Jan 2002 21:09:47 +0100


Hi,

I am trying to make an external-method from an Zope-2.1.4 version work=20
under 2.4.3.

In this method I had a call to HTMLFile like this:

   return HTMLFile("Extensions/authform.dtml",self.__dict__,globals())()

apparently the signature has changed now I have to do

  return DTMLFile("authform",globals())

but this results always in:

Error type: KeyError
Error value: __name__

File=20
/usr/local/ZopePark/tozo2.aixtraware.de/ZInstanceHome/Extensions/POSHClient
.py, line 62, in GetAuth
    (Object: pay)
  File=20
/usr/local/ZopePark/ZopeVersions/Zope-2.4.3/lib/python/App/special_dtml.py, =

line 173, in __init__
    (Object: HTMLFile)
  File=20
/usr/local/ZopePark/ZopeVersions/Zope-2.4.3/lib/python/App/special_dtml.py, =

line 106, in __init__
    (Object: HTMLFile)
  File=20
/usr/local/ZopePark/ZopeVersions/Zope-2.4.3/lib/python/App/Common.py, line=20
160, in package_home

The lines starting from 103 in special_dtml.py

    def __init__(self,name,_prefix=3DNone, **kw):
        if _prefix is None: _prefix=3DSOFTWARE_HOME
        elif type(_prefix) is not type(''):
            _prefix=3DCommon.package_home(_prefix)
        args=3D(self, os.path.join(_prefix, name + '.dtml'))
        if not kw.has_key('__name__'):
            kw['__name__']=3Dos.path.split(name)[-1]
        apply(ClassicHTMLFile.inheritedAttribute('__init__'),args,kw)

and the lines starting from 167 in special_dtml.py

    def __init__(self, name, _prefix=3DNone, **kw):

        self.ZBindings_edit(defaultBindings)
        self._setFuncSignature()
        apply(DTMLFile.inheritedAttribute('__init__'),
              (self, name, _prefix), kw)


>From looking at the code, I would assume, that _prefix is None, since it is =

nowhere defined. But _prefix=3DCommon.package_home(_prefix) is executed.

What's wrong here ?


Mit freundlichen Gr=FC=DFen                              Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurb=FCro f=FCr Internetanwendungen
H=FCsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------
Key fingerprint =3D DA10 CC82 62F8 1DBB 39A1  1EDC 725B 3317 A8D7 C3A6
Keyserver: http://germany.keyserver.net/en/