Open GoogleCodeExporter opened 8 years ago
This is already on my list for version 3 and I'll mark it as such. Thanks.
Original comment by justin.d...@gmail.com
on 16 Dec 2008 at 1:21
Original comment by justin.d...@gmail.com
on 16 Dec 2008 at 1:21
as a temporary workaround, I did something like this:
class Picture(photologue.models.ImageModel) :
def __init__(self, *args, **kwargs):
self.sized_image=ImageSizeAccessor()
self.sized_image._parent = self
super(Picture, self).__init__(*args, **kwargs)
class ImageSizeAccessor(object):
"""
convenient argument-free image size access for templates through the
sized_image attribute
"""
def __getitem__(self, key):
return {
'size': getattr(self._parent, 'get_%s_size' % key)(),
'url': getattr(self._parent, 'get_%s_url' % key)(),
'filename': getattr(self._parent, 'get_%s_filename' % key)(),
# 'photosize': getattr(self.å_parent, 'get_%s_photosize' % key),
}
HTH
Original comment by dan.mack...@gmail.com
on 24 Dec 2008 at 8:25
Original issue reported on code.google.com by
cgr...@gmail.com
on 16 Dec 2008 at 9:44