Comment 6 for bug 121759

Revision history for this message
Gavin Panella (allenap) wrote :

James, sorry for taking a while to reply. I found the following duplication of logic:

== webapp/publication.py ==

    def callObject(self, request, ob):

        # Don't render any content on a redirect.
        if request.response.getStatus() in [301, 302, 303, 307]:
            return ''

== webapp/generalform.py ==

class NoRenderingOnRedirect:
    """Mix-in for not rendering the page on redirects."""

    def __call__(self):
        # Call update() here instead of from the template to avoid
        # rendering the page on redirects.
        self.update()
        if self.request.response.getStatus() in [301, 302, 303]:
            # Don't render the page on redirects.
            return u''

== webapp/publisher.py ==

    def _isRedirected(self):
        """Return True if a redirect was requested.

        Check if the response status is one of 301, 302, 303 or 307.
        """
        return self.request.response.getStatus() in [301, 302, 303, 307]

== ftests/_launchpadformharness.py ==

    def wasRedirected(self):
        return self.request.response.getStatus() in [302, 303]