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
7ab4d542
Commit
7ab4d542
authored
Jul 16, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8 cleanup
parent
f1fe0d88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
src/App/ImageFile.py
src/App/ImageFile.py
+11
-9
No files found.
src/App/ImageFile.py
View file @
7ab4d542
...
@@ -32,17 +32,17 @@ from ZPublisher.Iterators import filestream_iterator
...
@@ -32,17 +32,17 @@ from ZPublisher.Iterators import filestream_iterator
import
Zope2
import
Zope2
PREFIX
=
os
.
path
.
realpath
(
PREFIX
=
os
.
path
.
realpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
Zope2
.
__file__
),
os
.
path
.
pardir
)
os
.
path
.
join
(
os
.
path
.
dirname
(
Zope2
.
__file__
),
os
.
path
.
pardir
))
)
NON_PREFIX_WARNING
=
(
'Assuming image location to be present in the Zope2 '
NON_PREFIX_WARNING
=
(
'Assuming image location to be present in the Zope2 '
'distribution. This is deprecated and might lead to '
'distribution. This is deprecated and might lead to '
'broken code if the directory in question is moved '
'broken code if the directory in question is moved '
'to another distribution. Please provide either an '
'to another distribution. Please provide either an '
'absolute file system path or a prefix. Support for '
'absolute file system path or a prefix. Support for '
'relative filenames without a prefix might be '
'relative filenames without a prefix might be '
'dropped in a future Zope2 release.'
)
'dropped in a future Zope2 release.'
)
class
ImageFile
(
Explicit
):
class
ImageFile
(
Explicit
):
"""Image objects stored in external files."""
"""Image objects stored in external files."""
...
@@ -53,7 +53,7 @@ class ImageFile(Explicit):
...
@@ -53,7 +53,7 @@ class ImageFile(Explicit):
if
_prefix
is
None
:
if
_prefix
is
None
:
_prefix
=
getattr
(
getConfiguration
(),
'softwarehome'
,
None
)
or
PREFIX
_prefix
=
getattr
(
getConfiguration
(),
'softwarehome'
,
None
)
or
PREFIX
if
not
os
.
path
.
isabs
(
path
):
if
not
os
.
path
.
isabs
(
path
):
warnings
.
warn
(
NON_PREFIX_WARNING
,
UserWarning
,
2
)
warnings
.
warn
(
NON_PREFIX_WARNING
,
UserWarning
,
2
)
elif
type
(
_prefix
)
is
not
type
(
''
):
elif
type
(
_prefix
)
is
not
type
(
''
):
_prefix
=
package_home
(
_prefix
)
_prefix
=
package_home
(
_prefix
)
# _prefix is ignored if path is absolute
# _prefix is ignored if path is absolute
...
@@ -82,7 +82,7 @@ class ImageFile(Explicit):
...
@@ -82,7 +82,7 @@ class ImageFile(Explicit):
self
.
content_type
=
content_type
self
.
content_type
=
content_type
else
:
else
:
ext
=
os
.
path
.
splitext
(
path
)[
-
1
].
replace
(
'.'
,
''
)
ext
=
os
.
path
.
splitext
(
path
)[
-
1
].
replace
(
'.'
,
''
)
self
.
content_type
=
'image/%s'
%
ext
self
.
content_type
=
'image/%s'
%
ext
self
.
__name__
=
os
.
path
.
split
(
path
)[
-
1
]
self
.
__name__
=
os
.
path
.
split
(
path
)[
-
1
]
stat_info
=
os
.
stat
(
path
)
stat_info
=
os
.
stat
(
path
)
...
@@ -108,8 +108,10 @@ class ImageFile(Explicit):
...
@@ -108,8 +108,10 @@ class ImageFile(Explicit):
# with common servers such as Apache (which can usually
# with common servers such as Apache (which can usually
# understand the screwy date string as a lucky side effect
# understand the screwy date string as a lucky side effect
# of the way they parse it).
# of the way they parse it).
try
:
mod_since
=
long
(
DateTime
(
header
).
timeTime
())
try
:
except
:
mod_since
=
None
mod_since
=
long
(
DateTime
(
header
).
timeTime
())
except
:
mod_since
=
None
if
mod_since
is
not
None
:
if
mod_since
is
not
None
:
if
getattr
(
self
,
'lmt'
,
None
):
if
getattr
(
self
,
'lmt'
,
None
):
last_mod
=
long
(
self
.
lmt
)
last_mod
=
long
(
self
.
lmt
)
...
...
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