[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/Zope Products

webmaster@zope.org webmaster@zope.org
Sat, 16 Nov 2002 03:01:26 -0500


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Products.stx#3-50

---------------

      Now you should build some DTML Methods and Python Scripts to test
      your poll instance. Here's a Python Script to figure out voting
      percentages::

        ## Script (Python) "getPercentFor"
        ##parameters=index
        ##
        """
        Returns the percentage of the vote given a response index. Note,
        this script should be bound a poll by acquisition context.
        """
        poll=context
        return float(poll.getVotesFor(index)) / poll.getTotalVotes()

        % Anonymous User - Nov. 16, 2002 3:01 am:
         Just exactly where should one add this Script?