[Zope] Inheritance (?) problem

Luca Manini manini@flashnet.it
Fri, 3 May 2002 16:10:31 +0200


Hi, 

I have a pure-python (no Zope classes around) 'form' class like this:

class form:

    def __init__(self, id):
        self.id = id

    def actionTarget(self, REQUEST={}):
        "Main entry point."
        return 'foo'

>From this class I derive a subclass 

class zopeForm (SimpleItem.SimpleItem, form):

    def actionTarget(self, REQUEST={}):
        "Main entry point."
        # ... other thing done here...
	form.actionTarget (self, REQUEST)

The zopeForm class is part of a product so I have instances of
zopeForm (say 'zf') in a folder (say 'foo'). Now I would like to visit
the URL

    ...../foo/zf/actionTarget
	
but I get the following error:

	Error Type: TypeError
        Error Value: unbound method must be called with 
		     class instance 1st argument

but 'self' in the call to form.actionTarget should be a zopeForm
instance! 

If I change zopeForm.actionTarget to:

    def actionTarget(self, REQUEST={}):
        "Main entry point. Passing http REQUEST"
        raise self

I get 

	Error Type: TypeError
        Error Value: exceptions must be strings, classes, or instances

and if I change it to:

    def actionTarget(self, REQUEST={}):
        "Main entry point. Passing http REQUEST"
        raise str(self)

I get

	Error Type: 
        Error Value: None



	It seems I'm missing something....
	Any hint?
	TIA, Luca