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?
_______________________________________________
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )