[Erp5-report] r39446 kazuhiko - /erp5/trunk/products/ERP5/Document/Image.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 21 15:46:52 CEST 2010
Author: kazuhiko
Date: Thu Oct 21 15:46:51 2010
New Revision: 39446
URL: http://svn.erp5.org?rev=39446&view=rev
Log:
we no longer need to define '__src__' method for Image that returns a '<img src=...>' tag.
Modified:
erp5/trunk/products/ERP5/Document/Image.py
Modified: erp5/trunk/products/ERP5/Document/Image.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Image.py?rev=39446&r1=39445&r2=39446&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Image.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Image.py [utf8] Thu Oct 21 15:46:51 2010
@@ -183,71 +183,6 @@ class Image(TextConvertableMixin, File,
else:
return self._baseGetContentType(default)
- #
- # Photo display methods
- #
-
- security.declareProtected(Permissions.View, 'tag')
- def tag(self, display=None, height=None, width=None, cookie=0,
- alt=None, css_class=None, format=None, quality=_MARKER,
- resolution=None, frame=None, **kw):
- """Return HTML img tag."""
- self._upradeImage()
-
- # Get cookie if display is not specified.
- if display is None:
- display = self.REQUEST.cookies.get('display', None)
- if quality is _MARKER:
- quality = self.getDefaultImageQuality(format)
- # display may be set from a cookie.
- image_size = self.getSizeFromImageDisplay(display)
- convert_kw = dict(format=format, quality=quality, resolution=resolution,
- frame=frame, image_size=image_size)
- try:
- mime, image = self.getConversion(**convert_kw)
- except KeyError:
- # Generate photo on-the-fly
- mime, image = self._makeDisplayPhoto(**convert_kw)
- self.setConversion(image, mime, **convert_kw)
- width, height = image.width, image.height
- # Set cookie for chosen size
- if cookie:
- self.REQUEST.RESPONSE.setCookie('display', display, path="/")
-
- if display:
- result = '<img src="%s?display=%s"' % (self.absolute_url(), display)
- else:
- result = '<img src="%s"' % (self.absolute_url())
-
- if alt is None:
- alt = getattr(self, 'title', '')
- if alt == '':
- alt = self.getId()
- result = '%s alt="%s"' % (result, html_quote(alt))
-
- if height:
- result = '%s height="%s"' % (result, height)
-
- if width:
- result = '%s width="%s"' % (result, width)
-
- if not 'border' in map(string.lower, kw.keys()):
- result = '%s border="0"' % (result)
-
- if css_class is not None:
- result = '%s class="%s"' % (result, css_class)
-
- for key in kw.keys():
- value = kw.get(key)
- result = '%s %s="%s"' % (result, key, value)
-
- result = '%s />' % (result)
-
- return result
-
- def __str__(self):
- return self.tag()
-
security.declareProtected(Permissions.AccessContentsInformation, 'displayIds')
def displayIds(self, exclude=('thumbnail',)):
"""Return list of display Ids."""
More information about the Erp5-report
mailing list