[Zope] Programmatically creating a DTML Document?

Chris McDonough chrism@digicool.com
Sat, 05 Feb 2000 19:26:18 -0500


Robb,

You'd do something like this from within DTML:

<dtml-call expr="manage_addDTMLDocument('mydocumentid',
'mydocumentitle', mycontent)">

Where mycontent is a string object containing your document's content. 
This will add a DTML document to the folder which contains the method
that contains this DTML snippet with an id of 'mydocumentid', a title of
'mydocumentitle'.

You're probably going to want to use XML-RPC to do this from your
servlet, however.  The name looks scary, but it's real easy.  XML-RPC is
a protocol that Zope speaks that works over HTTP.  It lets you call
methods of Zope objects programmatically from outside the Zope
application.  There are a couple of Java packages that let you make use
of XML-RPC, you can see them at http://www.xmlrpc.com/.  Also, you might
want to check out Amos Latteier's XML-RPC article at
http://www.xml.com/pub/2000/01/xmlrpc/index.html

You may also want to print out a copy of the Zope Quick Reference,
available at http://www.zope.org/Members/ZQR.  This is a work that is
attempting to document all the available methods on objects within Zope.

Good luck!

Robb Shecter wrote:
> 
> Hi,
> 
> I'm testing out using Zope as an HTTP-accessible database.  (To be
> used by Java servlets!)  Being lazy, I want to save my info as DTML
> Documents.  I can't figure out how to programmatically make a new
> document in a sub folder, or set its contents.  (I have seen pointers
> and examples for setting attributes of existing objects.)  Can anyone
> help?
> 
> Thanks,
> Robb
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
Chris McDonough
Digital Creations, Inc.
Zope - http://www.zope.org