Going mad with this one... I'm trying to write a Python script to return a random image from a specified folder. For example, here's how I may want to call it from a ZPT page: <span tal:replace="randomImage('Advertisements/BannerAds') / > My randomImage Python script is as follows (where 'directory' is the parameter being passed to the script): import string import random directory_context = string.replace("/", ".", directory) return directory + "/" + random.choice(context.directory_context.objectValues('Image')) Some of you may recognize this as being almost an exact copy of the script on p151 of "The Zope Book", with the only difference being that I'm trying to pass a folder name as a parameter. I'm pretty sure I need to do the directory_context step, but I can't get it to work either with or without it. Where I'm really struggling is in getting my head around the context stuff. Can anyone offer me some assistance? Thanks in advance Dave Mitchell