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
7159fa5c
Commit
7159fa5c
authored
Apr 15, 2002
by
Toby Dickenson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged toby-cacheable-zmi-branch
parent
6b6c466a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
lib/python/App/ImageFile.py
lib/python/App/ImageFile.py
+12
-4
lib/python/App/dtml/manage_page_style.css.dtml
lib/python/App/dtml/manage_page_style.css.dtml
+1
-0
No files found.
lib/python/App/ImageFile.py
View file @
7159fa5c
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
##############################################################################
##############################################################################
"""Image object that is stored in a file"""
"""Image object that is stored in a file"""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
from
OFS.content_types
import
guess_content_type
from
OFS.content_types
import
guess_content_type
from
Globals
import
package_home
from
Globals
import
package_home
...
@@ -21,9 +21,9 @@ from DateTime import DateTime
...
@@ -21,9 +21,9 @@ from DateTime import DateTime
from
time
import
time
from
time
import
time
from
os
import
stat
from
os
import
stat
import
Acquisition
import
Acquisition
import
Globals
import
os
import
os
class
ImageFile
(
Acquisition
.
Explicit
):
class
ImageFile
(
Acquisition
.
Explicit
):
"""Image objects stored in external files."""
"""Image objects stored in external files."""
...
@@ -33,6 +33,13 @@ class ImageFile(Acquisition.Explicit):
...
@@ -33,6 +33,13 @@ class ImageFile(Acquisition.Explicit):
_prefix
=
package_home
(
_prefix
)
_prefix
=
package_home
(
_prefix
)
path
=
os
.
path
.
join
(
_prefix
,
path
)
path
=
os
.
path
.
join
(
_prefix
,
path
)
self
.
path
=
path
self
.
path
=
path
if
Globals
.
DevelopmentMode
:
# In development mode, shorter is handy
max_age
=
60
else
:
# In production mode, longer reduces latency
max_age
=
600
self
.
cch
=
'public,max-age=%d'
%
max_age
file
=
open
(
path
,
'rb'
)
file
=
open
(
path
,
'rb'
)
data
=
file
.
read
()
data
=
file
.
read
()
...
@@ -52,6 +59,9 @@ class ImageFile(Acquisition.Explicit):
...
@@ -52,6 +59,9 @@ class ImageFile(Acquisition.Explicit):
# HTTP If-Modified-Since header handling. This is duplicated
# HTTP If-Modified-Since header handling. This is duplicated
# from OFS.Image.Image - it really should be consolidated
# from OFS.Image.Image - it really should be consolidated
# somewhere...
# somewhere...
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
content_type
)
RESPONSE
.
setHeader
(
'Last-Modified'
,
self
.
lmh
)
RESPONSE
.
setHeader
(
'Cache-Control'
,
self
.
cch
)
header
=
REQUEST
.
get_header
(
'If-Modified-Since'
,
None
)
header
=
REQUEST
.
get_header
(
'If-Modified-Since'
,
None
)
if
header
is
not
None
:
if
header
is
not
None
:
header
=
header
.
split
(
';'
)[
0
]
header
=
header
.
split
(
';'
)[
0
]
...
@@ -72,8 +82,6 @@ class ImageFile(Acquisition.Explicit):
...
@@ -72,8 +82,6 @@ class ImageFile(Acquisition.Explicit):
RESPONSE
.
setStatus
(
304
)
RESPONSE
.
setStatus
(
304
)
return
''
return
''
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
content_type
)
RESPONSE
.
setHeader
(
'Last-Modified'
,
self
.
lmh
)
f
=
open
(
self
.
path
,
'rb'
)
f
=
open
(
self
.
path
,
'rb'
)
data
=
f
.
read
()
data
=
f
.
read
()
f
.
close
()
f
.
close
()
...
...
lib/python/App/dtml/manage_page_style.css.dtml
View file @
7159fa5c
<dtml-unless zmi_embedded_css>
<dtml-unless zmi_embedded_css>
<dtml-call "RESPONSE.setHeader('Content-Type','text/css')">
<dtml-call "RESPONSE.setHeader('Content-Type','text/css')">
<dtml-call "RESPONSE.setHeader('Cache-Control','public,max-age=3600')">
</dtml-unless>
</dtml-unless>
h1 {
h1 {
font-family: Verdana, Helvetica, sans-serif;
font-family: Verdana, Helvetica, sans-serif;
...
...
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