[Zope3-dev] Fix for request retry on ConflictError

Sven Schomaker Sven.Schomaker at linie-m.de
Tue Jul 18 04:28:09 EDT 2006


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



More information about the Zope3-dev mailing list