[Zope] rendering the contents of ..

David Siedband david at generation-xml.com
Tue Aug 2 20:20:51 EDT 2005


I think something like this is what you're looking for:

===

from Products.PythonScripts.standard import html_quote
import random
request = container.REQUEST
RESPONSE =  request.RESPONSE
q = container.quotes.objectValues('File')
return random.choice(q)

===

cheers
--
David



On Aug 2, 2005, at 2:40 PM, David Bear wrote:


>> [ ... ]
>>
>
> sorry to be dense here. Its been a long time since I read the zope
> book. I have the following code:
> =============
> from Products.PythonScripts.standard import html_quote
> import random
> request = container.REQUEST
> RESPONSE =  request.RESPONSE
> # Return a string identifying this script.
> q = container.quotes.objectIds()
> print random.choice(q)()
> return printed
> =============
>
> But this returns an TypeError, str is not callable. How do I get this
> code to return a random object from the quotes container?
>






More information about the Zope mailing list