[Zope3-dev] Fix for request retry on ConflictError

Jim Fulton jim at zope.com
Tue Jul 18 06:01:46 EDT 2006


PLease submit a collector issue at:

   http://www.zope.org/Collectors/Zope3-dev

A test would be especially helpful.

Jim

On Jul 18, 2006, at 4:28 AM, Sven Schomaker wrote:

> Hi all,
>
> the retry of a request in case of a ConflictError in Zope 3.2.1 fails
> with a NotFound error, while looking up the requested view in
> zope/app/traversing/namespace.py (line 362).
>
> It seems as the newly created request (in request.retry()) does
> somehow not satisfy the adapter prerequisites to successfully
> look up a view in zope.component.queryMultiadapter.
>
> I did not dig too deep to find out what exactly goes wrong in the old
> statement used to create the new request instance, but I suppose
> somehow not all specifications (interfaces) of the original request
> are set up on the new request. Nevertheless I came up with a (quick)
> fix in zope/publisher/http.py that circumvents the issue.
>
> I don't know whether this is already fixed in the trunk or the fix
> appeals to the devs with check-in permissions, but maybe someone
> wants to look at it and check it in (or comes up with a better/more
> precise one:)).
>
>
> greetings,
>
> Sven Schomaker
>
>
> Index: http.py
> ===================================================================
> --- http.py     (revision 178)
> +++ http.py     (working copy)
> @@ -15,6 +15,7 @@
>
> $Id: http.py 41004 2005-12-23 21:01:20Z jim $
> """
> +from copy import copy
> import re, time, random
> from cStringIO import StringIO
> from urllib import quote, unquote, splitport
> @@ -435,13 +436,12 @@
>         'See IPublisherRequest'
>         count = getattr(self, '_retry_count', 0)
>         self._retry_count = count + 1
> -
> -        new_response = self.response.retry()
> -        request = self.__class__(
> +        request = copy(self)
> +        request.__init__(
>             # Use the cache stream as the new input stream.
>             body_instream=self._body_instream.getCacheStream(),
>             environ=self._orig_env,
> -            response=new_response,
> +            response=self.response.retry(),
>             )
>         request.setPublication(self.publication)
>         request._retry_count = self._retry_count
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/jim%40zope.com
>

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Zope3-dev mailing list