[Zope] Creating products from Python scripts

Dieter Maurer dieter@handshake.de
Fri, 9 Nov 2001 21:30:57 +0100


=?iso-8859-1?Q?Carlos_Alberto_Micucci?= writes:
 > I'm Argentino and my English is poor, sorry.
Your english is good!

 > ....
 > My first problem is create instances objects of ZOPE
 > from Python scripts, like: ZSQLMethods, ZODBCDA,
 > folders, and so.
 > I've probed with manage_addProduct (where Product is
 > de name of product to create).
 > Folders objects is OK, from manage (test) and visiting
 > URL from browser.
 > ZSQLMethods objects trought an error from URL and from
 > manage (view): attribute error.
 > By other way, I've probed with ZOQL product (Insert
 > ...) but some products like "Z ODBC Database
 > Connections" trought an error like: object is not
 > callable.

   <objectManager>.manage_addProduct['ZSQLMethod'].manage_addZSQLMethod

should work.

 > ....
 > Other: which is the correct way to pass arguments (or
 > parameters) to product ZOPE object (like ZOQL Methods,
 > for example) from Python scripts? (ZOQL Methods object
 > and Python scripts are in the same folder). Have you
 > any example?
Unfortunately, parameter passing is object (class) specific.

ZSQL Methods (more precisely, their "__call__" method)
accept parameters either from the request object or
from keyword parameters (exclusively).
Thus you have either:

     container.<sqlMethodId>() # arguments from REQUEST

or

     container.<sqlMethodId>(param1=value1, param2=value2, ....)



Dieter