[Zope3-dev] Fix for request retry on ConflictError

2006-07-18 Thread Sven Schomaker

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@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Fix for request retry on ConflictError

2006-07-18 Thread Sven Schomaker

Jim Fulton wrote:

PLease submit a collector issue at:

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

A test would be especially helpful.


Yeehaw, I was afraid someone would ask for such a thing.
I must admit I actually wasn't able to write it up to now,
since I'm not too familiar with all the traversal stuff and
the like and howto setup a test for that issue.

Poor me - I figured out the solution by torturing our app
with a bunch of simultaneous requests and provoking
some ConflictErrors.

Since that is not helpful at all, someone may help me on
writing a formal test?

greetings,

Sven


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@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/jim%40zope.com



--
Jim Fultonmailto:[EMAIL PROTECTED]Python Powered!
CTO (540) 361-1714http://www.python.org
Zope Corporationhttp://www.zope.comhttp://www.zope.org






--
__Addressed by:_

Sven Holger Cochise Schomaker, Dipl.-Inf. (FH)

Linie M - Metall Form Farbe - GmbH
Industriestrae 8
63674 Altenstadt (Hessen)
Germany

Tel.: +49 (0)6047 97121
Fax: +49 (0)6047 97122

Mail: [EMAIL PROTECTED]

Public Key: hkp://subkeys.pgp.net

Key ID: F04D3E4F

Key fingerprint: 79BD FBEB F6AE 7005 8374  
320A 0D13 F202 F04D 3E4F


___

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] zope tales api patch

2006-06-30 Thread Sven Schomaker

Hi all,

I got some minor enhancements to the zope tales API. 
Maybe someone can check this into the repos, if it's 
of public interest.


kind regards,

sven





Index: 
/data/mnemonic/Workspace/Zope-3.2.1/Dependencies/zope.app-Zope-3.2.1/zope.app/pagetemplate/talesapi.py
===
--- 
/data/mnemonic/Workspace/Zope-3.2.1/Dependencies/zope.app-Zope-3.2.1/zope.app/pagetemplate/talesapi.py
  (revision 177)
+++ 
/data/mnemonic/Workspace/Zope-3.2.1/Dependencies/zope.app-Zope-3.2.1/zope.app/pagetemplate/talesapi.py
  (working copy)
@@ -51,6 +51,34 @@
 return a.description
 description = property(description)
 
+def subjects(self):
+a = IZopeDublinCore(self.context, None)
+if a is None:
+raise AttributeError('subjects')
+return a.subjects
+subjects = property(subjects)
+
+def creators(self):
+a = IZopeDublinCore(self.context, None)
+if a is None:
+raise AttributeError('creators')
+return a.creators
+creators = property(creators)
+
+def contributors(self):
+a = IZopeDublinCore(self.context, None)
+if a is None:
+raise AttributeError('contributors')
+return a.contributors
+contributors = property(contributors)
+
+def publishers(self):
+a = IZopeDublinCore(self.context, None)
+if a is None:
+raise AttributeError('publishers')
+return a.publishers
+publishers = property(publishers)
+
 def created(self):
 a = IZopeDublinCore(self.context, None)
 if a is None:
@@ -64,7 +92,14 @@
 raise AttributeError('modified')
 return a.modified
 modified = property(modified)
-
+
+def identifier(self):
+a = IZopeDublinCore(self.context, None)
+if a is None:
+raise AttributeError('identifier')
+return a.identifier
+identifier = property(identifier)
+
 def name(self):
 return zapi.name(self.context)
 


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Maybe bug in pagetemplate parser?

2005-11-13 Thread Sven Schomaker
Hi all, 

currently I'm trying to output a pretty tiny code
snippet in a page template, but the compilation 
fails due to a nesting error. It seems as if the 
pt engine erroneously parses the following snippet,
complaining about a nesting error on the closing
div:


script type=text/javascript
   !--
   document.write('div id=LOADING_DOCUMENT_HINTLoading document.
Please be patient.../div');
   //--
/script

It also fails if I declare the whole script 
content as XML CDATA section using ![CDATA[ ...

Is this is user error or a parser bug? Some
help is very appreciated:-)

Greetings Sven

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Extending the zope tales api.

2005-06-14 Thread Sven Schomaker

Hi all,

would anyone mind if we extend the ZopeTalesAPI
to give access to all DC metadata actually in use
by zope3 (such as creators).

Maybe we could also provide access to the absolute
url as is similarly done with the objects size?

Regards, Sven
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com