[Zope] DTML Method or PyScript returning image?
Timothy Wilson
wilson@visi.com
Tue, 9 Oct 2001 06:48:24 -0500 (CDT)
On Mon, 8 Oct 2001, CJ Kucera wrote:
> Basically, my situation is this: I've got images 1.gif, 2.gif, 3.gif,
> and 4.gif in a folder. What I want to do is set up an object of
> some sort called "image.gif", which, when called, would randomly return
> one of the other graphics in the Folder.
Maybe I'm misunderstanding your requirements, but a quick Python script can
return a selection from a group of images. Something like:
"""
This script returns a random image.
"""
import random
return random.choice(context.objectValues('Image'))
I use this appoach to display a random quote at the bottom of my Web page.
-Tim
--
Tim Wilson | Visit Sibley online: | Check out:
Henry Sibley HS | http://www.isd197.org | http://www.zope.com
W. St. Paul, MN | | http://slashdot.org
wilson@visi.com | <dtml-var pithy_quote> | http://linux.com