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
6ba02eba
Commit
6ba02eba
authored
Mar 27, 2001
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged fixes for MOVE, COPY Destination header handling
parent
2bf9a0b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+23
-13
No files found.
lib/python/webdav/Resource.py
View file @
6ba02eba
...
...
@@ -85,7 +85,7 @@
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.4
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
1
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
davcmds
,
ExtensionClass
,
Lockable
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
,
tokenFinder
,
urlbase
...
...
@@ -339,20 +339,29 @@ class Resource(ExtensionClass.Base, Lockable.LockableItem):
if
not
hasattr
(
aq_base
(
self
),
'cb_isCopyable'
)
or
\
not
self
.
cb_isCopyable
():
raise
'Method Not Allowed'
,
'This object may not be copied.'
depth
=
REQUEST
.
get_header
(
'Depth'
,
'infinity'
)
if
not
depth
in
(
'0'
,
'infinity'
):
raise
'Bad Request'
,
'Invalid Depth header.'
dest
=
REQUEST
.
get_header
(
'Destination'
,
''
)
while
dest
and
dest
[
-
1
]
==
'/'
:
dest
=
dest
[:
-
1
]
if
not
dest
:
raise
'Bad Request'
,
'Invalid Destination header.'
path
,
(
bad1
,
bad2
,
pct
)
=
REQUEST
.
physicalPathFromURL
(
dest
)
if
pct
<
1
or
bad2
:
raise
'Bad Request'
,
'Invalid Destination header'
name
=
path
.
pop
()
parent_path
=
string
.
join
(
path
,
'/'
)
oflag
=
string
.
upper
(
REQUEST
.
get_header
(
'Overwrite'
,
'F'
))
if
not
oflag
in
(
'T'
,
'F'
):
raise
'Bad Request'
,
'Invalid Overwrite header.'
path
,
name
=
os
.
path
.
split
(
dest
)
name
=
unquote
(
name
)
try
:
parent
=
REQUEST
.
resolve_url
(
path
)
try
:
parent
=
self
.
restrictedTraverse
(
path
)
except
ValueError
:
raise
'Conflict'
,
'Attempt to copy to an unknown namespace.'
except
'Not Found'
:
...
...
@@ -423,26 +432,27 @@ class Resource(ExtensionClass.Base, Lockable.LockableItem):
if
not
hasattr
(
aq_base
(
self
),
'cb_isMoveable'
)
or
\
not
self
.
cb_isMoveable
():
raise
'Method Not Allowed'
,
'This object may not be moved.'
dest
=
REQUEST
.
get_header
(
'Destination'
,
''
)
while
dest
and
dest
[
-
1
]
==
'/'
:
dest
=
dest
[:
-
1
]
if
not
dest
:
path
,
(
bad1
,
bad2
,
pct
)
=
REQUEST
.
physicalPathFromURL
(
dest
)
if
pct
<
1
or
bad2
:
raise
'Bad Request'
,
'No destination given'
flag
=
REQUEST
.
get_header
(
'Overwrite'
,
'F'
)
flag
=
string
.
upper
(
flag
)
body
=
REQUEST
.
get
(
'BODY'
,
''
)
path
,
name
=
os
.
path
.
split
(
dest
)
name
=
unquote
(
name
)
try
:
parent
=
REQUEST
.
resolve_url
(
path
)
name
=
path
.
pop
()
parent_path
=
string
.
join
(
path
,
'/'
)
try
:
parent
=
self
.
restrictedTraverse
(
path
)
except
ValueError
:
raise
'Conflict'
,
'Attempt to move to an unknown namespace.'
except
'Not Found'
:
raise
'Conflict'
,
'The resource %s must exist.'
%
path
raise
'Conflict'
,
'The resource %s must exist.'
%
pa
rent_pa
th
except
:
t
,
v
,
tb
=
sys
.
exc_info
()
raise
t
,
v
if
hasattr
(
parent
,
'__null_resource__'
):
raise
'Conflict'
,
'The resource %s must exist.'
%
path
raise
'Conflict'
,
'The resource %s must exist.'
%
pa
rent_pa
th
existing
=
hasattr
(
aq_base
(
parent
),
name
)
if
existing
and
flag
==
'F'
:
raise
'Precondition Failed'
,
'Resource %s exists.'
%
dest
...
...
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