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