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
1777c67a
Commit
1777c67a
authored
Aug 14, 2002
by
Brian Lloyd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged fixes for 332.
parent
bebc1897
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
13 deletions
+17
-13
lib/python/webdav/NullResource.py
lib/python/webdav/NullResource.py
+3
-3
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+3
-2
lib/python/webdav/common.py
lib/python/webdav/common.py
+4
-2
lib/python/webdav/davcmds.py
lib/python/webdav/davcmds.py
+7
-6
No files found.
lib/python/webdav/NullResource.py
View file @
1777c67a
...
...
@@ -13,7 +13,7 @@
"""WebDAV support - null resource objects."""
__version__
=
'$Revision: 1.3
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
7
$'
[
11
:
-
2
]
import
sys
,
os
,
mimetypes
,
Globals
,
davcmds
import
Acquisition
,
OFS
.
content_types
...
...
@@ -25,7 +25,7 @@ from Globals import Persistent, DTMLFile
from
WriteLockInterface
import
WriteLockInterface
import
OFS.SimpleItem
from
zExceptions
import
Unauthorized
from
common
import
isDavCollection
class
NullResource
(
Persistent
,
Acquisition
.
Implicit
,
Resource
):
"""Null resources are used to handle HTTP method calls on
...
...
@@ -137,7 +137,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
if
hasattr
(
aq_base
(
parent
),
name
):
raise
'Method Not Allowed'
,
'The name %s is in use.'
%
name
if
not
hasattr
(
parent
,
'__dav_collection__'
):
if
not
isDavCollection
(
parent
):
raise
'Forbidden'
,
'Cannot create collection at this location.'
ifhdr
=
REQUEST
.
get_header
(
'If'
,
''
)
...
...
lib/python/webdav/Resource.py
View file @
1777c67a
...
...
@@ -13,7 +13,7 @@
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
import
sys
,
os
,
mimetypes
,
davcmds
,
ExtensionClass
,
Lockable
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
,
tokenFinder
,
urlbase
...
...
@@ -24,6 +24,7 @@ from WriteLockInterface import WriteLockInterface
import
Globals
,
time
from
ZPublisher.HTTPRangeSupport
import
HTTPRangeInterface
from
zExceptions
import
Unauthorized
from
common
import
isDavCollection
class
Resource
(
ExtensionClass
.
Base
,
Lockable
.
LockableItem
):
"""The Resource mixin class provides basic WebDAV support for
...
...
@@ -357,7 +358,7 @@ class Resource(ExtensionClass.Base, Lockable.LockableItem):
ob
.
wl_clearLocks
()
ob
.
_setId
(
name
)
if
depth
==
'0'
and
hasattr
(
ob
,
'__dav_collection__'
):
if
depth
==
'0'
and
isDavCollection
(
ob
):
for
id
in
ob
.
objectIds
():
ob
.
_delObject
(
id
)
if
existing
:
...
...
lib/python/webdav/common.py
View file @
1777c67a
...
...
@@ -13,7 +13,7 @@
"""Commonly used functions for WebDAV support modules."""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
time
,
urllib
,
re
from
App.Common
import
iso8601_date
,
rfc850_date
,
rfc1123_date
...
...
@@ -59,7 +59,9 @@ def generateLockToken():
return
'%s-%s-00105A989226:%.03f'
%
\
(
_randGen
.
random
(),
_randGen
.
random
(),
time
.
time
())
def
isDavCollection
(
object
):
"""Return true if object is a DAV collection."""
return
getattr
(
object
,
'__dav_collection__'
,
0
)
def
tokenFinder
(
token
):
# takes a string like '<opaquelocktoken:afsdfadfadf> and returns the token
...
...
lib/python/webdav/davcmds.py
View file @
1777c67a
...
...
@@ -13,7 +13,7 @@
"""WebDAV xml request objects."""
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
9
$'
[
11
:
-
2
]
import
sys
,
os
from
common
import
absattr
,
aq_base
,
urlfix
,
urlbase
...
...
@@ -25,6 +25,7 @@ from xmltools import XmlParser
from
cStringIO
import
StringIO
from
urllib
import
quote
from
AccessControl
import
getSecurityManager
from
common
import
isDavCollection
def
safe_quote
(
url
,
mark
=
r'%'
):
if
url
.
find
(
mark
)
>
-
1
:
...
...
@@ -90,7 +91,7 @@ class PropFind:
url
=
urlbase
(
url
)
result
.
write
(
'<?xml version="1.0" encoding="utf-8"?>
\
n
'
\
'<d:multistatus xmlns:d="DAV:">
\
n
'
)
iscol
=
hasattr
(
obj
,
'__dav_collection__'
)
iscol
=
isDavCollection
(
obj
)
if
iscol
and
url
[
-
1
]
!=
'/'
:
url
=
url
+
'/'
result
.
write
(
'<d:response>
\
n
<d:href>%s</d:href>
\
n
'
%
safe_quote
(
url
))
if
hasattr
(
aq_base
(
obj
),
'propertysheets'
):
...
...
@@ -209,7 +210,7 @@ class PropPatch:
def
apply
(
self
,
obj
):
url
=
urlfix
(
self
.
request
[
'URL'
],
'PROPPATCH'
)
if
hasattr
(
obj
,
'__dav_collection__'
):
if
isDavCollection
(
obj
):
url
=
url
+
'/'
result
=
StringIO
()
errors
=
[]
...
...
@@ -323,7 +324,7 @@ class Lock:
result
=
StringIO
()
url
=
urlfix
(
self
.
request
[
'URL'
],
'LOCK'
)
url
=
urlbase
(
url
)
iscol
=
hasattr
(
obj
,
'__dav_collection__'
)
iscol
=
isDavCollection
(
obj
)
if
iscol
and
url
[
-
1
]
!=
'/'
:
url
=
url
+
'/'
errmsg
=
None
lock
=
None
...
...
@@ -397,7 +398,7 @@ class Unlock:
result
=
StringIO
()
url
=
urlfix
(
url
,
'UNLOCK'
)
url
=
urlbase
(
url
)
iscol
=
hasattr
(
obj
,
'__dav_collection__'
)
iscol
=
isDavCollection
(
obj
)
if
iscol
and
url
[
-
1
]
!=
'/'
:
url
=
url
+
'/'
errmsg
=
None
...
...
@@ -455,7 +456,7 @@ class DeleteCollection:
result
=
StringIO
()
url
=
urlfix
(
url
,
'DELETE'
)
url
=
urlbase
(
url
)
iscol
=
hasattr
(
obj
,
'__dav_collection__'
)
iscol
=
isDavCollection
(
obj
)
errmsg
=
None
parent
=
aq_parent
(
obj
)
...
...
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