[Zope] object instance from script

Aurélien Campéas aurelien.aa@wanadoo.fr
03 Jul 2003 18:43:34 +0200


I apologize in advance if this is some kind of FAQ,

nervertheless, here's my quesion :

I build some simple Product some days ago. It's accessible from the ZMI
and works as expected.

However, I really need it to be instanciated not from the ZMI but from
one python script.

The exact course of action remains quite unclear, even after reading
huge amounts of various docs.


The products is 'Candidat'.

Here's what I put in some dumb script :

print "Hello from build_candidat"

cand = context.manage_addProduct['Candidat']
try:
 one_c = cand ("M", "A", "B", "add", "mail", "bp", "ville", "tel", "cv",
"motiv")
except Exception, e:
 print e
print cand

return printed


when executed, I get this :

Hello from build_candidat
__call__
<__FactoryDispatcher__ instance at 9089dc0>


No comment about 1st line.
Second line is the exception ('cand' not callable ???)
Third line tells us about what is 'cand'.

I'm sure there's something simple to do around those lines, but it's a
little bit hard to find the right info...

Thank you for your patience,
Aurélien.