[PEAK] MethodExporter examples don't seem to work

Phillip J. Eby pje at telecommunity.com
Sun Nov 2 19:05:45 EST 2003


At 01:33 AM 11/2/03 -0500, Victor Ng wrote:
>Hi, I've been trying to use the MethodExporter metaclass but I can't seem 
>to get the example code to run.  I'm using the sample code in 
>method_exporter.py, but I always seem to get the following error:
>
>   File "slap.py", line 28, in ?
>     joe.slapFace("Thanks, I needed that!")
>AttributeError: 'Person' object has no attribute 'slapFace'
>
>Anyone knows what's going on?  I'm running a build of PEAK from CVS 
>checked out today and I'm on Python 2.3.0 (MacPython - OSX)

It's a documentation bug.  Your 'Person' class needs to have a metaclass 
that derives from 'binding.Activator'.  Adding this line:

     __metaclass__ = binding.Activator

to the Person class makes the example work.  I've fixed the examples 
docstring in CVS now.




More information about the PEAK mailing list