[Zope] Versions was: LOCK/UNLOCK

Tim Cook tim@freepm.org
Wed, 28 Mar 2001 12:42:17 -0600


"Fernstrom, Christer" wrote:

> I haven't found parts of the ZOPE API that deals with handling versions, but I was playing with the idea to provide a "modify" button on the pages that would:
>  - create a personal version for the user (unless one is already there)
>  - start using the version
>  - go to the manage_main for the page to allow updates
>  - upon SAVE (hm, how do I catch this?), commit the version changes (ie do version "save")
>  - redisplay the rendered page
> 
> Looks simple on the paper. Has anybody done something like this? Would it work?

I 'started'.
This creates a temporary version:

DTML Method: start_version
----------------------
<dtml-call "REQUEST.set('ver_id',_.str(_.int(ZopeTime())))">
<dtml-with "manage_addProduct['OFSP']">
  <dtml-call "manage_addVersion(id=ver_id,
title=AUTHENTICATED_USER.getUserName(),REQUEST=_.None)">
</dtml-with>

<dtml-return ver_id>
---------------------- 

It's called from here and then entered:
(anywhere you want to enter a new version for editing)
----------------------
<dtml-let ver_id=start_version>
<dtml-var expr="_.getitem(ver_id).enter(REQUEST,RESPONSE)">
</dtml-let>
----------------------

at this point I've tried several things to get it to redirect
back to another DTML Method but it goes to manage_main.  I REALLY
don't want to have to patch Zope to prevent this.  Other things
were more pressing so I haven't gotten back to it yet.

HTH,
-- 
Tim Cook, President - FreePM,Inc. 
http://www.FreePM.com Office: (901) 884-4126
ONLINE DEMO: http://www.freepm.org:8080/FreePM