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.
Maybe this will help http://www.zopelabs.com/cookbook/1012279676 Steven Hayles - Computer Systems Developer, sh23@le.ac.uk Learning Technology Section, Computer Centre, University of Leicester, University Rd, Leicester, LE1 7RH Fax (0/+44)116 2525027 WWW <URL:http://www.le.ac.uk/home/sh23> On 3 Jul 2003, [ISO-8859-1] Aur�lien Camp�as wrote:
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.
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Yes ! Thanks... Aurélien Le ven 04/07/2003 à 11:06, Steven Hayles a écrit :
Maybe this will help http://www.zopelabs.com/cookbook/1012279676
Steven Hayles - Computer Systems Developer, sh23@le.ac.uk Learning Technology Section, Computer Centre, University of Leicester, University Rd, Leicester, LE1 7RH Fax (0/+44)116 2525027 WWW <URL:http://www.le.ac.uk/home/sh23>
participants (2)
-
Aurélien Campéas -
Steven Hayles