[Zope] Programmatic creation/update of ZSQL methods

Clemens Robbenhaar zope@zope.org
Thu, 31 Oct 2002 21:27:01 +0100


Charlie Reiman writes:
 > I've got about 60 or so ZSQL methods that I maintain in my Zope. Actually, I
 > don't maintain them: our Oracle expert changes them then I have to translate
 > them into DTML, split them into little chunks, and upload them into zope.
 > 
 > Since I'm terribly lazy I've automated the DTMLification and the splitting.
 > But the third step of uploading the ZSQL bodies is tricker. Currently I'm
 > uploading them via FTP but this requires that the methods already exist (due
 > to a lack of object type magic). I've also tried using xmlrpc but
 > manage_addZSQLMethod does not seem to live on Folder so I'm not sure how I
 > can call it.
 > 
 > So my question is: How can I create ZSQL methods from an external program (a
 > python script in this case)? I've got the body, the id, the destination, the
 > connection id, the parameters... everything but a clue.

 Its maybe ugly, but how about faking the ZMI form by doing something
like:

 lynx -dump -auth admin:clear_text_passwd \
    'http://localhost:8080/my_sql_folder/manage_addZSQLMethod?id=new_sql_method&title=foo&connection_id=my_db&arguments=&template:text=select+*'

Afterwards the SQL method should be there and may be edited via FTP.

 Or is this too ugly? Maybe someone else one the list knows a better way
to add arbitrary typed objects programatically.

Cheers,
Clemens