[Zope] Why 'unbound method' error?

peter sabaini sabaini@inode.at
Sat, 27 Jul 2002 22:24:02 +0200


this is a common problem, see
http://debian.acm.ndsu.nodak.edu/doc/python-extclass/ExtensionClass.html
for a description (search for 'inheritedAttribute')

hth, peter.

Warnes, Gregory R wrote:
> I've just modified a python product and I've started getting an error that
> doesn't make sense to me.
> 
> Here's the error message:
> 
> Error Type: TypeError
> Error Value: unbound method connect() must be called with instance as first
> argument
> [...]
>  File
> /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD
> A/RSessionDA.py, line 213, in putFile
>     (Object: RSession)
>   File
> /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD
> A/RSOAP/localRSOAPConnection.py, line 124, in uploadFile
>     (Object: RSession)
>   File
> /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD
> A/RSOAP/localRSOAPConnection.py, line 49, in connect
>     (Object: RSession)
> TypeError: (see above)
> 
> and the 'offending' code:
> 
> class RSession(localRSOAPConnection, SimpleItem):
>     '''Connection object to the R Kernel'''
> 
>      # no connect method defined here ... #
>     ....
> 
> class localRSOAPConnection(RSOAPConnection):
> 
>     def connect(self):
>         flag = RSOAPConnection.connect(self)
> 
>         if flag:
>             self.__checklocal()
> 
>         return flag
> 
>      ....
> 
> 
> The localRSOAPConnection code works just fine in standalone Python.    In
> Zope the localRSOAPConnection is extended by RSession with methods that are
> Zope-aware.  
> 
> My question is why is the call to 'connect' failing in Zope?    I am passing
> a valid instance with the self argument...
> 
> Ideas appreciated...
> 
> -Greg
> 
> 
> 
> 
> 
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
>