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
ca13a012
Commit
ca13a012
authored
Mar 09, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
c1d9696a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
30 deletions
+33
-30
lib/python/webdav/Collection.py
lib/python/webdav/Collection.py
+2
-9
lib/python/webdav/NullResource.py
lib/python/webdav/NullResource.py
+29
-20
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+2
-1
No files found.
lib/python/webdav/Collection.py
View file @
ca13a012
...
...
@@ -85,7 +85,7 @@
"""WebDAV support - collection objects."""
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
from
Resource
import
Resource
...
...
@@ -110,13 +110,6 @@ class Collection(Resource):
response
.
setHeader
(
'Date'
,
rfc1123_date
())
response
.
setHeader
(
'DAV'
,
'1'
)
def
HEAD
(
self
,
REQUEST
,
RESPONSE
):
"""Retrieve resource information without a response body."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
RESPONSE
.
setStatus
(
200
)
return
RESPONSE
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
"""The PUT method has no inherent meaning for collection
resources, though collections are not specifically forbidden
...
...
@@ -129,7 +122,7 @@ class Collection(Resource):
"""Delete a collection resource. For collection resources, DELETE
may return either 200 (OK) or 204 (No Content) to indicate total
success, or may return 207 (Multistatus) to indicate partial
success. Note that in Zope a DELETE never returns 207."""
success. Note that in Zope a DELETE
currently
never returns 207."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
url
=
urlfix
(
REQUEST
[
'URL'
],
'DELETE'
)
name
=
filter
(
None
,
string
.
split
(
url
,
'/'
))[
-
1
]
...
...
lib/python/webdav/NullResource.py
View file @
ca13a012
...
...
@@ -85,11 +85,12 @@
"""WebDAV support - null resource objects."""
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
import
Acquisition
,
OFS
.
content_types
from
common
import
absattr
,
aq_base
,
urlfix
from
AccessControl.Permission
import
Permission
from
Resource
import
Resource
from
Globals
import
Persistent
...
...
@@ -101,17 +102,25 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
__dav_null__
=
1
__ac_permissions__
=
(
(
'View'
,
(
'HEAD'
,)),
(
'Access contents information'
,
(
'PROPFIND'
,)),
(
'Add Folders'
,
(
'MKCOL'
,)),
(
'Delete objects'
,
(
'DELETE'
,)),
(
'Manage properties'
,
(
'PROPPATCH'
,)),
(
'View'
,
(
'HEAD'
,)),
(
'Access contents information'
,
(
'PROPFIND'
,)),
(
'Add Documents, Images, and Files'
,
(
'PUT'
,)),
(
'Add Folders'
,
(
'MKCOL'
,)),
(
'Delete objects'
,
(
'DELETE'
,)),
(
'Manage properties'
,
(
'PROPPATCH'
,)),
)
def
__init__
(
self
,
parent
,
id
):
self
.
id
=
id
def
__init__
(
self
,
parent
,
name
,
request
=
None
):
self
.
__name__
=
name
self
.
__parent__
=
parent
# self.__roles__=parent.__roles__
# if hasattr(parent, '__ac_permissions__'):
# for p in parent.__ac_permissions__:
# n, v=p[:2]
# if n=='Add Documents, Images, and Files':
# roles=Permission(n, v, parent).getRoles()
# break
# self.PUT__roles__=roles
def
__bobo_traverse__
(
self
,
REQUEST
,
name
=
None
):
# We must handle traversal so that we can recognize situations
...
...
@@ -137,8 +146,9 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
self
.
dav__init
(
REQUEST
,
RESPONSE
)
type
=
REQUEST
.
get_header
(
'content-type'
,
None
)
body
=
REQUEST
.
get
(
'BODY'
,
''
)
name
=
self
.
__name__
if
type
is
None
:
type
,
enc
=
mimetypes
.
guess_type
(
self
.
id
)
type
,
enc
=
mimetypes
.
guess_type
(
name
)
if
type
is
None
:
if
OFS
.
content_types
.
find_binary
(
body
)
>=
0
:
content_type
=
'application/octet-stream'
...
...
@@ -146,13 +156,13 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
type
=
string
.
lower
(
type
)
from
OFS.Image
import
Image
,
File
if
type
in
(
'text/html'
,
'text/xml'
,
'text/plain'
):
self
.
__parent__
.
manage_addDTMLDocument
(
self
.
id
,
''
,
body
)
self
.
__parent__
.
manage_addDTMLDocument
(
name
,
''
,
body
)
elif
type
[:
6
]
==
'image/'
:
ob
=
Image
(
self
.
id
,
''
,
body
,
content_type
=
type
)
self
.
__parent__
.
_setObject
(
self
.
id
,
ob
)
ob
=
Image
(
name
,
''
,
body
,
content_type
=
type
)
self
.
__parent__
.
_setObject
(
name
,
ob
)
else
:
ob
=
File
(
self
.
id
,
''
,
body
,
content_type
=
type
)
self
.
__parent__
.
_setObject
(
self
.
id
,
ob
)
ob
=
File
(
name
,
''
,
body
,
content_type
=
type
)
self
.
__parent__
.
_setObject
(
name
,
ob
)
RESPONSE
.
setStatus
(
201
)
RESPONSE
.
setBody
(
''
)
return
RESPONSE
...
...
@@ -163,13 +173,12 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
if
REQUEST
.
get
(
'BODY'
,
''
):
raise
'Unsupported Media Type'
,
'Unknown request body.'
parent
=
self
.
__parent__
if
hasattr
(
aq_base
(
parent
),
self
.
id
):
raise
'Method Not Allowed'
,
'The name %s is in use.'
%
self
.
id
name
=
self
.
__name__
if
hasattr
(
aq_base
(
parent
),
name
):
raise
'Method Not Allowed'
,
'The name %s is in use.'
%
name
if
not
hasattr
(
parent
,
'__dav_collection__'
):
raise
'Forbidden'
,
'Unable to create collection resource.'
# This should probably do self.__class__(id, ...), except Folder
# doesn't currently have a constructor.
parent
.
manage_addFolder
(
self
.
id
)
parent
.
manage_addFolder
(
name
)
RESPONSE
.
setStatus
(
201
)
RESPONSE
.
setBody
(
''
)
return
RESPONSE
...
...
lib/python/webdav/Resource.py
View file @
ca13a012
...
...
@@ -85,7 +85,7 @@
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
xmlcmds
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
...
...
@@ -163,6 +163,7 @@ class Resource:
RESPONSE
.
setHeader
(
'Content-Type'
,
absattr
(
self
.
content_type
))
if
hasattr
(
self
,
'getSize'
):
RESPONSE
.
setHeader
(
'Content-Length'
,
absattr
(
self
.
getSize
))
RESPONSE
.
setStatus
(
200
)
return
RESPONSE
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
...
...
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