[Zope-dev] Question: How can instatiate a Zclass from python.

Martin Grönemeyer martin@comunit.de
Fri, 03 Nov 2000 12:13:19 +0100


At 13:30 02.11.00 +0200, you wrote:
>I am creating an external method in python and I want to add a product (in
>that method) which is a Zclass (only, it doesn't exists in the
>lib/python/Products directory). How can I instatiate this object and how
>can I overide the name error that will occur (because I haven't import
>anything)?
>

I think for a quick work'a'round you could use this snippet. If you are
using an external method pass the self explizitly to your method, e.g.
<dtml-call "getNewZClass(this(),otherParameter)">. In your method you have
to define the self as first argument.

self.aq_acquire('Control_Panel').Products.NameOfYourZClassProduct.NameOfYour
ZClass(Instance-Parameter)

Good luck.
i.A.
Martin Grönemeyer
Technik

|| | ||  c o m.u n i t   G m b H  ||| | | ||  |  | |   |  | | |   |

http://www.comunit.de/  <mailto:martin@comunit.de>
Eiffestr. 598		20537 Hamburg | Germany
Fon +49 +40 | 21 11 05 25	Fax  +49 +40 | 21 11 05 26