Commit 419eb703 authored by Michel Pelletier's avatar Michel Pelletier

Added Martijn Pieters patch to Bruce Perens' patch to Image.py

parent c222ef9a
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Image object""" """Image object"""
__version__='$Revision: 1.79 $'[11:-2] __version__='$Revision: 1.80 $'[11:-2]
import Globals, string, struct, content_types import Globals, string, struct, content_types
from OFS.content_types import guess_content_type from OFS.content_types import guess_content_type
...@@ -453,24 +453,27 @@ class Image(File): ...@@ -453,24 +453,27 @@ class Image(File):
downloading of images. Defaults are applied intelligently for downloading of images. Defaults are applied intelligently for
'height', 'width', and 'alt'. 'height', 'width', and 'alt'.
""" """
if not alt:
alt=self.title_or_id()
string='<img src="%s" alt="%s"' % (self.absolute_url(), alt) string='<img src="%s"' % (self.absolute_url())
if alt==None:
alt=self.title_or_id()
if alt:
string = '%s alt="%s"' % (string, alt)
if not height: if height==None:
height = self.height height = self.height
if height: if height:
string = "%s height=%s" % (string, height) string = '%s height="%s"' % (string, height)
if not width: if width==None:
width = self.width width = self.width
if width: if width:
string = "%s width=%s" % (string, width) string = '%s width="%s"' % (string, width)
for key in args.keys(): for key in args.keys():
value = args.get(key) value = args.get(key)
string = "%s %s=%s" % (string, key, value) string = '%s %s="%s"' % (string, key, value)
return string + '>' return string + '>'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment