Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ba079592
Commit
ba079592
authored
Oct 08, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sneaky trickery to mimic just enough level 2 DAV support to allow
us to interoperate with MS Office 2000.
parent
44cd739b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
22 deletions
+39
-22
lib/python/webdav/NullResource.py
lib/python/webdav/NullResource.py
+1
-11
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+38
-11
No files found.
lib/python/webdav/NullResource.py
View file @
ba079592
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
"""WebDAV support - null resource objects."""
"""WebDAV support - null resource objects."""
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
Globals
import
sys
,
os
,
string
,
mimetypes
,
Globals
import
Acquisition
,
OFS
.
content_types
import
Acquisition
,
OFS
.
content_types
...
@@ -167,16 +167,6 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
...
@@ -167,16 +167,6 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
RESPONSE
.
setBody
(
''
)
RESPONSE
.
setBody
(
''
)
return
RESPONSE
return
RESPONSE
def
LOCK
(
self
,
REQUEST
,
RESPONSE
):
"""Create a lock-null resource."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
raise
'Method Not Allowed'
,
'Method not supported for this resource.'
def
UNLOCK
(
self
):
"""Remove a lock-null resource."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
raise
'Method Not Allowed'
,
'Method not supported for this resource.'
Globals
.
default__class_init__
(
NullResource
)
Globals
.
default__class_init__
(
NullResource
)
lib/python/webdav/Resource.py
View file @
ba079592
...
@@ -85,12 +85,12 @@
...
@@ -85,12 +85,12 @@
"""WebDAV support - resource objects."""
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.2
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
davcmds
,
ExtensionClass
import
sys
,
os
,
string
,
mimetypes
,
davcmds
,
ExtensionClass
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
from
urllib
import
quote
,
unquote
from
urllib
import
quote
,
unquote
import
Globals
import
Globals
,
time
class
Resource
(
ExtensionClass
.
Base
):
class
Resource
(
ExtensionClass
.
Base
):
"""The Resource mixin class provides basic WebDAV support for
"""The Resource mixin class provides basic WebDAV support for
...
@@ -348,21 +348,48 @@ class Resource(ExtensionClass.Base):
...
@@ -348,21 +348,48 @@ class Resource(ExtensionClass.Base):
return
RESPONSE
return
RESPONSE
# WebDAV Class 2 support
# WebDAV Class 2 is currently not really supported - the
# following merely fakes enough class 2 support to allow
# operation with MS O2K.
_v_dav_lock
=
None
def
dav__genlocktoken
(
self
):
return
'AA9F6414-1D77-11D3-B825-00105A989226:%.03f'
%
time
.
time
()
def
LOCK
(
self
,
REQUEST
,
RESPONSE
):
def
LOCK
(
self
,
REQUEST
,
RESPONSE
):
"""A write lock MUST prevent a principal without the lock from
"""Lock a resource"""
successfully executing a PUT, POST, PROPPATCH, LOCK, UNLOCK, MOVE,
DELETE, or MKCOL on the locked resource. All other current methods,
GET in particular, function independently of the lock.
"""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
self
.
dav__init
(
REQUEST
,
RESPONSE
)
raise
'Method Not Allowed'
,
'Method not supported for this resource.'
token
=
self
.
dav__genlocktoken
()
self
.
_v_dav_lock
=
token
RESPONSE
.
setStatus
(
200
)
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/xml; charset="utf-8"'
)
RESPONSE
.
setHeader
(
'Lock-Token'
,
'<locktoken:%s>'
%
token
)
RESPONSE
.
setBody
(
self
.
fake_lock_xml
%
token
)
return
RESPONSE
def
UNLOCK
(
self
):
def
UNLOCK
(
self
):
"""Remove an existing lock on a resource."""
"""Remove an existing lock on a resource."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
self
.
dav__init
(
REQUEST
,
RESPONSE
)
raise
'Method Not Allowed'
,
'Method not supported for this resource.'
self
.
_v_dav_lock
=
None
RESPONSE
.
setStatus
(
204
)
return
RESPONSE
fake_lock_xml
=
"""<?xml version="1.0" encoding="utf-8" ?>
<d:prop xmlns:d="DAV:">
<d:lockdiscovery>
<d:activelock>
<d:locktype><d:write/></d:locktype>
<d:lockscope><d:exclusive/></d:lockscope>
<d:depth>0</d:depth>
<d:owner>you</d:owner>
<d:timeout>Second-120</d:timeout>
<d:locktoken>
<d:href>locktoken:%s</d:href>
</d:locktoken>
</d:activelock>
</d:lockdiscovery>
</d:prop>"""
Globals
.
default__class_init__
(
Resource
)
Globals
.
default__class_init__
(
Resource
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment