[Zope] - Copying Zope objects programmatically

A.M. Kuchling akuchlin@cnri.reston.va.us
Wed, 30 Dec 1998 22:27:00 -0500


Continuing on my channeling, I'm now trying to let users enter a
selected ID; a folder named with that ID would then be created and set
up.

Creating the folder in DTML is easy:

<!--#call expr="_['user'].manage_addFolder(userid)"-->

I can even set a property on the newly created folder: 

<!--#call expr="_['user'][userid].manage_addProperty('cl', 'c1 c2 c3', 'tokens')"-->

(Incidentally, these expression lines are getting awfully long.  Is
there any way to insert newlines in them?)

However, I can't figure out how to create a new index_html object
whose content is a duplicate of another default object; the third
argument to the manage_addDocument() is never right.

<!--call expr="_['user'].manage_addDocument('index_html', 
                                            'User Page:'+userid, 
                                            _['default_user_page'].data)"-->

_['default_user_page'].data doesn't work.  str(_['default_user_page']) 
creates the page, but it also replaces < with &lt;, so the DTML on the 
resulting page doesn't work.  How do you get the contents of the
Document object without it being escaped?  

Or am I barking up the wrong tree?  Should this sort of thing be
implemented as an ExternalMethod?

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
A sincere compliment is always grateful to a lady, so long as you don't try to
knock her down with it.
    -- Mark Twain