[Zope] Problems publishing simple object directly thru ZServer

Max Møller Rasmussen maxm@normik.dk
Wed, 9 Aug 2000 14:16:52 +0200


----------------------------------------------------------------------
I have made a very simple class that I am trying to publish thru ZServer:
----------------------------------------------------------------------
class hello:

    """A very simple publishable objet in zope"""

    def world(self):
        "DocStrings are NOT optional"
        return "hello world"
----------------------------------------------------------------------
I have changed the following in z2.py
----------------------------------------------------------------------

#zh = zhttp_handler(MODULE, '', HTTP_ENV)
#hs.install_handler(zh)
        
sys.path.insert(0,'C:/root/pythonScripts/hello') # add MyModule to the
Python path
my_handler = zhttp_handler('hello', '')          # create a handler
hs.install_handler(my_handler)                   # install it in the http
server#

----------------------------------------------------------------------
And I get this traceback:
----------------------------------------------------------------------

Zope Error
Zope has encountered an error while publishing this resource. 

exceptions.TypeError

Sorry, a Zope error occurred.

Traceback (innermost last):
  File C:\mxmZope\lib\python\ZPublisher\Publish.py, line 222, in
publish_module
  File C:\mxmZope\lib\python\ZPublisher\Publish.py, line 171, in publish
  File C:\mxmZope\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: world)
  File C:\mxmZope\lib\python\ZPublisher\Publish.py, line 112, in call_object
    (Object: world)
TypeError: unbound method must be called with class instance 1st argument
----------------------------------------------------------------------

Can anyone see the error of my ways? I can't. I would think that: "unbound
method must be called with class instance 1st argument" would mean I had
forgotten "self" in my method but this is clearly not the case.

Kind Regards Max M