Hi folks, Because many existing Windows programs understand FTP but not WebDAV, we're trying to create an alternative way to lock/unlock files when we FTP them. This could be a simple HTTP call (preferred) or XML-RPC. The documentation I've been able to dig up on Zope's DAV implementation isn't too clear on how to programmatically lock/unlock files. I can easily check if a file is locked using DTML Methods, but actually locking it has eluded me. Do I have to create a Lock object first? At first wl_lockItems, wl_lockTokens, and wl_getLock all looked like methods to create a lock, but they seem to be methods for retrieving existing locks, wl_setLock seems to be what I want but I don't see how to create a token or a lock item. Can I do this in a DTML Method? TIA --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)
On Thursday, November 1, 2001, at 05:20 PM, Dethe Elza wrote:
Because many existing Windows programs understand FTP but not WebDAV, we're trying to create an alternative way to lock/unlock files when we FTP them. This could be a simple HTTP call (preferred) or XML-RPC. The documentation I've been able to dig up on Zope's DAV implementation isn't too clear on how to programmatically lock/unlock files.
I can easily check if a file is locked using DTML Methods, but actually locking it has eluded me. Do I have to create a Lock object first? At first wl_lockItems, wl_lockTokens, and wl_getLock all looked like methods to create a lock, but they seem to be methods for retrieving existing locks, wl_setLock seems to be what I want but I don't see how to create a token or a lock item. Can I do this in a DTML Method?
When the WebDAV writelocking project was in its early stages, some debate went to whether the locking mechanism should be exposed to a higher level, and what that mechanism would be. Ultimately, however, it was decided that WebDAV writelocking would be kept entirely within the WebDAV system. It's not recommended that you try to use these outside of that, primarily due to the importance of the 'locktoken' objects, which you need to understand in order to use wl_setLock() and other methods. Jeffrey P Shell, jeffrey@cuemedia.com
Jeffrey P Shell wrote:
When the WebDAV writelocking project was in its early stages, some debate went to whether the locking mechanism should be exposed to a higher level, and what that mechanism would be. Ultimately, however, it was decided that WebDAV writelocking would be kept entirely within the WebDAV system. It's not recommended that you try to use these outside of that, primarily due to the importance of the 'locktoken' objects, which you need to understand in order to use wl_setLock() and other methods.
Thanks for the feedback. Can you provide me any enlightenment or starting points for finding out more about these locktoken objects if I do pursue my ill-advised path? --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)
See Lockable.py and LockItem.py. Andreas ----- Original Message ----- From: "Dethe Elza" <dethe@burningtiger.com> To: "Jeffrey P Shell" <jeffrey@cuemedia.com> Cc: <zope-dev@zope.org> Sent: Thursday, November 01, 2001 19:38 Subject: Re: [Zope-dev] WebDAV API
Jeffrey P Shell wrote:
When the WebDAV writelocking project was in its early stages, some debate went to whether the locking mechanism should be exposed to a higher level, and what that mechanism would be. Ultimately, however, it was decided that WebDAV writelocking would be kept entirely within the WebDAV system. It's not recommended that you try to use these outside of that, primarily due to the importance of the 'locktoken' objects, which you need to understand in order to use wl_setLock() and other methods.
Thanks for the feedback. Can you provide me any enlightenment or starting points
for finding out more about these locktoken objects if I do pursue my ill-advised path?
--Dethe
--
Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Andreas Jung wrote:
See Lockable.py and LockItem.py.
OK, I was confused and thought an object could serve as it's own lock (Java does something like this). So I need to create a LockItem. Is this class accessible from a DTML Method or should I be looking at an External Method? Thanks again! --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)
On Thursday, November 1, 2001, at 06:53 PM, Dethe Elza wrote:
Andreas Jung wrote:
See Lockable.py and LockItem.py.
OK, I was confused and thought an object could serve as it's own lock (Java does something like this). So I need to create a LockItem. Is this class accessible from a DTML Method or should I be looking at an External Method?
An external method. LockItems basically model all of the data required by WebDAV to represent what is expected in a WebDAV "lockdiscovery" property. An object cannot serve as its own lock as there is not a larger locking mechanism in play here - only the WebDAV system. Thus, LockItems are very WebDAV specific - 'exclusive write lock' specific in fact. See also "webdav/davcmds.py", classes Lock and Unlock to see how the locks are created and applied. You might also want to check out the "seatbelt" mechanism in the CMF's Document class as an alternate approach. Jeffrey P Shell, jeffrey@cuemedia.com
Jeffrey P Shell wrote:
On Thursday, November 1, 2001, at 06:53 PM, Dethe Elza wrote:
Andreas Jung wrote:
See Lockable.py and LockItem.py.
OK, I was confused and thought an object could serve as it's own lock (Java does something like this). So I need to create a LockItem. Is this class accessible from a DTML Method or should I be looking at an External Method?
An external method.
Yes, that worked. I still need to run some tests to make sure that objects cannot be overwritten or edited, but I've got three methods which work throughout my Zope instance: /isWriteLocked, /writeLock, and /writeUnlock, which work consistently with each other and should be enough for our purposes. Thanks for the help! --Dethe -- Dethe Elza (delza@burningtiger.com) Chief Mad Scientist Burning Tiger Technologies (http://burningtiger.com) Living Code Weblog (http://livingcode.ca)
participants (3)
-
Andreas Jung -
Dethe Elza -
Jeffrey P Shell