[Zope] Getting REQUEST in product method by default
Kevin Smith
Kevin.Smith@themorgue.org
Fri, 01 Feb 2002 11:02:32 US/Eastern
> class ZMyClass(MyClass, Folder):
> """ Zope Folder subclass """
> def getData(self):
> REQUEST =3D self.REQUEST
> RESPONSE =3D REQUEST.RESPONSE
> ... validate REQUEST variables ...
> return MyClass.getData(self, REQUEST['user'], REQUEST['field'])
> =
> This way you can use <dtml-var getData> without passing =
> any arguments.
This works great! Thanks! But I see that there is something else wrong wi=
th my plan. When I try to call MyClass.getData(self, ...), I get an error =
essentially saying that my ZMyClass instance is not an instance of MyClass,=
so I can't call that method. Python's isinstance tells me that this is th=
e case even though issubclass verifies that ZMyClass is a subclass of MyCla=
ss. Is it not possible to wrap regular Python classes with Zope wrappers =
simply by inheriting from the regular class and a Zope class like Folder/Si=
mpleItem?
Kevin Smith
Kevin.Smith@theMorgue.org