[Zope] Programmatic creation/update of ZSQL methods
Charlie Reiman
creiman@kefta.com
Fri, 1 Nov 2002 12:26:15 -0800
Dieter sez:
> The usual way (there are a few exceptions, mainly very old
> products) to call constructors is
>
>
> <ObjectManager>.manage_addProduct[<yourProduct>].<contructor>(<arguments>)
>
> In URL form (this is what you need for XMLRFC), this is
>
> <URLToObjectManager>/manage_addProduct/<yourProduct>
>
> There, you call "<contructor>(<arguments>)".
>
>
> > ...
> > I know about PUT_factory but I didn't have much luck with that either.
> But, you do not tell us about the kind of problems....
Well, let's just ignore PUT_factory for the moment. I've almost got xmlrpc
working (pardon my word wrap):
srv = xmlrpclib.Server("http://srvr/test/manage_addProduct/ZSQLMethods",
transport = BasicAuthTransport(username="xxx",
password="yyyy"))
err= srv.manage_addZSQLMethod('amethod', 'atitle' 'zfly', 'one two',
'select sysdate from dual', 'xxx')
I'm still not sure what to invoke on srv. The above is as close as I have
come. It does create an object but it issues a 302 error response and the
object has incorrect paramters. I'm pretty certain that this is not the
right method to invoke (as it will expect an ObjectManager as the first
parameter, which I can't really pass across xmlrpc and it's designed for TTW
creation). However, I was unable to invoke the SQL constructor which is what
I think I need as that's what manage_addZSQLMethod calls.
If I call srv.SQL, I just get a "Cannot location object at:" exception.
If I call srv.SQL.__init__, I get some very strange things. First, it
demands 3 arguments (SQL.__init__ should take 5). The call seems to be
successful as the call returns None. But no object is created.
I'll go have another look at my PUT_factory effort and see if I can make
that work.