[Zope-dev] Naive API question(s)

Holger Blasum blasum@muc.de
Mon, 17 Sep 2001 18:15:08 +0200


Dear *, 

naively I volunteered for a talk on zope in autumn to a (small) CS student 
audience. However, I must confess that do not understand the 
basics about the API:

What is the most general and state-of-the-art way (including
necessary imports from the zope python library), to non-interactively
- add an Object o of type (class) t in context (directory location) c to Zope ?
- call a method m of that object (that eg was found in its source code) ?
- (optional) set and alter a public attribute a of that object ?
- delete that Object o from context c ?

Background: 
I naively assume that from a developers point of view, zope 
is nothing but a (great) storage bin for all kinds of objects (of course all 
the "hard stuff" has been done, with a nice user GUI, persistence, caching, 
transaction integrity etc).

And then I felt reassured that is also nice to know that in principle 
everything(?) is accessible via (authenticated) XML-RPC: 

class XMLRPCMessageHandler(StackMessageHandler):
  def __init__ (self):
    self.stack = []
    self.bat = BasicAuthTransport("guest","*****")
    self.server = xmlrpclib.Server("http://localhost:9673/", self.bat)
    self.server.manage_addDocument('foo3','Foo3','foo3s content')

However, as far as I understand (OFSP/__init__.py of version 2.3.3-1, l. 121)
"manage_addDocument" is a "legacy" API in the same way eg overuse of DTML is 
partly legacy-related, nor do I find a method for eg deleting documents in 
the Zope Book Appendix API doc. 

Also the ZSyncer source seems to give some hints but for me it is hard to 
differentiate ZSyncer-specific and general stuff.

Again, the question is *not* about how to write Products/scripts/ZClasses but 
rather to demonstrate that there is an elegant and coherent approach to the API,
its about http://www.zope.org//Wikis/DevSite/Projects/APIDocs/TheProblem ...

(in case it boils down to RTFS pls point out which files or which products 
are fruitful)

Many thanks in advance,

-- 
Holger Blasum <holger@blasum.net>
GnuPG 1024D/1CCA6604639C07F5146A