Re: [Zope] LOCK/UNLOCK
Looking through the mail archives I realise that I'm not the only person who has questions about locking in ZOPE. I know that you can use versions, and as long as every concurrent user does updates in a separate version, locks are set, visible to all, and prevents accidental overwrites. Problem is that users who are just content providers (not programmers) have to explicitly enter versions, then commit changes they've done in the versions. This is far from ideal. 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? christer christer.fernstrom@xrce.xerox.com
I am totaly baffeled by the correct usage of LOCKs in ZOPE. Example please?
Thanks, -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (901) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
"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
"Fernstrom, Christer" wrote:
I haven't found parts of the ZOPE API that deals with handling versions, but I was playing with the idea
The source for transactions is in /lib/python/ZODB/Transaction.py Versions save, info and discard are in /lib/python/App/ApplicationManager.py -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (901) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
participants (2)
-
Fernstrom, Christer -
Tim Cook