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

webmaster@zope.org webmaster@zope.org
Fri, 08 Nov 2002 20:34:40 -0500


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

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

      There still is a problem with the 'editPoll' method. When you call
      it from the 'editPollForm' through the web nothing is
      returned. This is a bad management interface. You want this method
      to return an HTML response when called from the web, but you do
      not want it to do this when it is called from '__init__'. Here's
      the solution::

        class Poll(...):
            ...

            def editPoll(self, question, responses, REQUEST=None):
                """
                Changes the question and responses.
                """
                self._question = question
                self._responses = responses
                self._votes = {}
                for i in range(len(responses)):
                    self._votes[i] = 0
                if REQUEST is not None:
                    return self.editPollForm(REQUEST,
                        manage_tabs_message='Poll question and responses changed.')

        % rboylan - July 24, 2002 1:49 am:
         In general, if you want to end up on a certain tab, how do you do it? Are there any conventions or standards?
         Working it out now seems to require cruising around the base classes to try to find the right tab, and then
         tracing around some more to find the actual filename that gives the contents of the tab.

        % Anonymous User - Nov. 8, 2002 8:34 pm:
         wouldnt a redirect do better since it refreshes the client browsers url?
         (but then of course the tabs_message would not appear...)