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
72e69612
Commit
72e69612
authored
Jun 09, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added default content type support
parent
edff4f8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
lib/python/OFS/DTMLMethod.py
lib/python/OFS/DTMLMethod.py
+5
-1
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+13
-8
No files found.
lib/python/OFS/DTMLMethod.py
View file @
72e69612
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""DTML Method objects."""
__version__
=
'$Revision: 1.4
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
6
$'
[
11
:
-
2
]
import
History
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
...
...
@@ -145,6 +145,10 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
(
'FTP access'
,
(
'manage_FTPstat'
,
'manage_FTPget'
,
'manage_FTPlist'
)),
)
# support a more reasonable default for content-type
# for http HEAD requests.
default_content_type
=
'text/html'
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
"""Render the document given a client object, REQUEST mapping,
Response, and key word arguments."""
...
...
lib/python/webdav/Resource.py
View file @
72e69612
...
...
@@ -85,7 +85,7 @@
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
davcmds
,
ExtensionClass
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
...
...
@@ -142,16 +142,21 @@ class Resource(ExtensionClass.Base):
def
HEAD
(
self
,
REQUEST
,
RESPONSE
):
"""Retrieve resource information without a response body."""
self
.
dav__init
(
REQUEST
,
RESPONSE
)
content_type
=
None
if
hasattr
(
self
,
'content_type'
):
RESPONSE
.
setHeader
(
'Content-Type'
,
absattr
(
self
.
content_type
)
)
els
e
:
content_type
=
absattr
(
self
.
content_type
)
if
content_type
is
Non
e
:
url
=
urlfix
(
REQUEST
[
'URL'
],
'HEAD'
)
name
=
unquote
(
filter
(
None
,
string
.
split
(
url
,
'/'
))[
-
1
])
ct
,
ce
=
mimetypes
.
guess_type
(
name
)
# Could try harder here...
ct
=
ct
or
'application/octet-stream'
ct
=
string
.
lower
(
ct
)
RESPONSE
.
setHeader
(
'Content-Type'
,
ct
)
content_type
,
encoding
=
mimetypes
.
guess_type
(
name
)
if
content_type
is
None
:
if
hasattr
(
self
,
'default_content_type'
):
content_type
=
absattr
(
self
.
default_content_type
)
if
content_type
is
None
:
content_type
=
'application/octet-stream'
RESPONSE
.
setHeader
(
'Content-Type'
,
string
.
lower
(
content_type
))
if
hasattr
(
aq_base
(
self
),
'get_size'
):
RESPONSE
.
setHeader
(
'Content-Length'
,
absattr
(
self
.
get_size
))
if
hasattr
(
self
,
'_p_mtime'
):
...
...
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