[Zope-dev] WebDAV API

2001-11-01 Thread Dethe Elza

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 ([EMAIL PROTECTED])
Chief Mad Scientist
Burning Tiger Technologies (http://burningtiger.com)
Living Code Weblog (http://livingcode.ca)


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Dethe Elza

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 ([EMAIL PROTECTED])
Chief Mad Scientist
Burning Tiger Technologies (http://burningtiger.com)
Living Code Weblog (http://livingcode.ca)


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Jeffrey P Shell

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, [EMAIL PROTECTED]


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Andreas Jung

See Lockable.py and LockItem.py.

Andreas
- Original Message -
From: Dethe Elza [EMAIL PROTECTED]
To: Jeffrey P Shell [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
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 ([EMAIL PROTECTED])
 Chief Mad Scientist
 Burning Tiger Technologies (http://burningtiger.com)
 Living Code Weblog (http://livingcode.ca)


 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 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 )




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Dethe Elza

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 ([EMAIL PROTECTED])
Chief Mad Scientist
Burning Tiger Technologies (http://burningtiger.com)
Living Code Weblog (http://livingcode.ca)


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Jeffrey P Shell

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, [EMAIL PROTECTED]


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )



Re: [Zope-dev] WebDAV API

2001-11-01 Thread Dethe Elza

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 ([EMAIL PROTECTED])
Chief Mad Scientist
Burning Tiger Technologies (http://burningtiger.com)
Living Code Weblog (http://livingcode.ca)


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )