[Zope-dev] bizarre __call__ problem

seb bacon seb@jamkit.com
Wed, 18 Jul 2001 12:30:48 +0100


A strange one.  In my product, which is a folderish content type, I
have two functions with identical function bodies and signatures; the
only difference is the function name.  I try calling them like this
from dtml: 

 <dtml-with "getPageByDepth()"> / <dtml-with "boogaLoo()">

>From the first I get an AttributeError, from the other I do not:

 < snip >
  File /usr/local/Zope/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval
                  (Object: getPageByDepth())
                  (Info: getPageByDepth)
                File <string>, line 0, in ?
              AttributeError: __call__


Any ideas?  The code is at the bottom of this mail.  For now I can
just use 'boogaLoo', but it's making me have bad dreams.

cheers,

seb

-=-=-=-=-=-=-=-=-=-=-=-=-=

    security.declarePublic('boogaLoo')
    def boogaLoo(self, depth=0):
        '''blah'''
        depth = int(depth)
        if self.getDepth() < depth:
            return self
        else:
            root = self.getSite().getPhysicalPath()
            r_pos = len(root)
            my_path = self.aq_inner.getPhysicalPath()[r_pos:]
            page = my_path[:depth]
            return self.unrestrictedTraverse(root + page)

    security.declarePublic('getPageByDepth')
    def getPageByDepth(self, depth=0):
        '''blah'''
        depth = int(depth)
        if self.getDepth() < depth:
            return self
        else:
            root = self.getSite().getPhysicalPath()
            r_pos = len(root)
            my_path = self.aq_inner.getPhysicalPath()[r_pos:]
            page = my_path[:depth]
            return self.unrestrictedTraverse(root + page)