[Zope] Changing of the SQL guard

Oliver Bleutgen Oliver Bleutgen <myzope@gmx.net>
Tue, 8 May 2001 18:52:28 +0200


> Greets all,

> I have installed a newer version of postgres on my linux box, along with
> the
> newer PoPy adapter and I have done some work in splitting out tables to
> separate dbs... The problem I'm faced with is that I have to reidentify
> all
> of the connections that each ZSQL method addresses to the adapter. Instead
> of manually changing each one (which are too many to count), is there a
> way
> I can do them all at once? The second db I use is very isolated so if I
> could just tell an entire tree to goto on db connection, that would be
> nice... I even tried using the same object name, but Im sure there is more
> hidden stuff behind its ID that this doesnt work...

I think could write a python script (or dtml-method) which recurses
through the subfolder and searches for ZSQL-methods.
If it finds one it calls 
manage_edit(self, title, connection_id, arguments, template)
with the right arguments.

from zope 2.3.2's help:
manage_edit(self, title, connection_id, arguments, template)
    Change database method properties.
    The connection_id argument is the id of a database connection that resides in the 
    current folder or in a folder above the current folder. The database should understand SQL.
    The arguments argument is a string containing an arguments specification, 
    as would be given in the SQL method cration form.
    The template argument is a string containing the source for the SQL Template.

cheers,
oliver