Re: [Zope-dev] ConflictError shouldn't subclass Exception

2005-11-25 Thread Dieter Maurer
Chris Withers wrote at 2005-11-24 19:34 +:
> ...
>and I firmly agree with, that zodb 
>conflicts should _not_ sublcass exception.

-1

>That way, there's less chance 
>of them being caught by inexperienced programmers putting in try: except 
>Exception: 's.

Most people that use an unrestricted "try ... except ..."
use "try: ... except: ..." and not "try: ... except Exception: ...",
thus your proposal will not help much...

>How would we go about making this change?

Do not do it at all.



-- 
Dieter
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] ConflictError shouldn't subclass Exception

2005-11-25 Thread Chris McDonough


On Nov 25, 2005, at 2:25 PM, Patrick Gerken wrote:


2005/11/24, Chris Withers <[EMAIL PROTECTED]>:

Interestingly, you can raise things that don't subclass Exception in
python. This was discussed before, and I firmly agree with, that zodb
conflicts should _not_ sublcass exception. That way, there's less  
chance
of them being caught by inexperienced programmers putting in try:  
except

Exception: 's.

How would we go about making this change?


class my_own_exception:
  pass

try:
  raise my_own_exception()
except:
  print "Doesn't help against inexperienced programmers. sadly"

You can even raise a string, which is accidently done in zope2 and
where my with provided solution and unit test is pending.
It is better to beat people using except: without good reasons.


Yup.  Lots of talk has been going on on python-dev about putting  
exceptions into multiple hierarchies lately, which would solve the  
problem at the right level.


- C


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] ConflictError in BTreeFolder2

2004-01-27 Thread Florent Guillaume
> > > I've fixed BTreeFolder2 to properly re-raise ConflictError in _delObject 
> > > [...]
> 
> > Are these patches available anywhere?
> 
> He's fixed them in CVS:
> 
> http://cvs.zope.org/Products/BTreeFolder2/BTreeFolder2.py.diff?r1=1.19&r2=1.20
> 
> > Have you let Shane know?
> 
> Assuming Shane listens to zope CVS mail notifications, yes :-)

Yes and I posted in zope-dev to let people know.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:[EMAIL PROTECTED]

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] ConflictError in BTreeFolder2

2004-01-27 Thread Leonardo Rochael Almeida

> Florent Guillaume wrote:
> 
> > FYI:
> > 
> > I've fixed BTreeFolder2 to properly re-raise ConflictError in _delObject 
> > [...]


On Tue, 2004-01-27 at 07:18, Chris Withers wrote:
> Are these patches available anywhere?

He's fixed them in CVS:

http://cvs.zope.org/Products/BTreeFolder2/BTreeFolder2.py.diff?r1=1.19&r2=1.20

> Have you let Shane know?

Assuming Shane listens to zope CVS mail notifications, yes :-)

Cheers, Leo

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] ConflictError in BTreeFolder2

2004-01-27 Thread Chris Withers
Are these patches available anywhere?

Have you let Shane know?

Chris

Florent Guillaume wrote:

FYI:

I've fixed BTreeFolder2 to properly re-raise ConflictError in _delObject 
and not swallow it during beforeDelete cleanups. This is the same fix 
that was done in ObjectManager.

Florent



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] ConflictError

2003-03-28 Thread Dieter Maurer
Andre Schubert wrote at 2003-3-28 10:15 +0100:
 > i have a little problem with the following log-entry in my logfile.
 > 
 > 2003-03-28T10:09:18 INFO(0) ZODB conflict error at /foo/bar/tab_kopf (1 conflicts 
 > since startup at 2003-03-28T10:09:03).
 > 
 > After searching through several mailinglists i found that this
 > error seem to occur when using sessions, i'am right ?
 > But my problem is, that tab_kopf is a ImageFile defined in my Product.
 > 
 > tab_kopf = ImageFile('www/tab_kopf.gif',globals())
 > 
 > I dont understand how there could be a ConflictError on a Image ?
 > I hope someone could give me a tip whats going on.

Please file a feature request to "".
Zope should distinguish between "Write" and "Read conflict errors".
You can try the necessary modification yourself. Patch
for Zope 2.6.1 attached.

You probably see a "Database read conflict error".
It may happen for reading "foo", "bar" or "tab_kopf".
The patch will give you hints what object got this error.


Dieter

--- Zope/App/startup.py~	2003-02-28 16:59:25.0 +0100
+++ Zope/App/startup.py	2003-03-17 11:13:28.0 +0100
@@ -140,9 +140,9 @@
 global conflict_errors
 conflict_errors = conflict_errors + 1
 method_name = REQUEST.get('PATH_INFO', '')
-err = ('ZODB conflict error at %s '
+err = ('ZODB conflict error at %s: %s'
'(%s conflicts since startup at %s)')
-LOG(err % (method_name, conflict_errors, startup_time),
+LOG(err % (method_name, str(v), conflict_errors, startup_time),
 INFO, '')
 LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
 raise ZPublisher.Retry(t, v, traceback)


Re: [Zope-dev] ConflictError

2003-03-28 Thread Leonardo Rochael Almeida
On Fri, 2003-03-28 at 06:15, Andre Schubert wrote:
> Hi all,
> 
> i have a little problem with the following log-entry in my logfile.
> 
> 2003-03-28T10:09:18 INFO(0) ZODB conflict error at /foo/bar/tab_kopf (1 conflicts 
> since startup at 2003-03-28T10:09:03).
> 
> After searching through several mailinglists i found that this
> error seem to occur when using sessions, i'am right ?
> But my problem is, that tab_kopf is a ImageFile defined in my Product.
> 
> tab_kopf = ImageFile('www/tab_kopf.gif',globals())
> 
> I dont understand how there could be a ConflictError on a Image ?
> I hope someone could give me a tip whats going on.

Conflict Errors are things that can happen during the normal course of a
Zope operation. They happen whenever a request tries to read or write an
object for the first time in a request (transaction) that started before
another request (transaction) that already modified such object. Zope
automatically restarts the conflicting transaction, so the only visible
effect is a little delay before the transaction finishes.

You should only worry if you're seeing a copious amount of such
messages, or if you are seeing these errors in the browser, which
happens after zope retries the transaction 3 times and still gets a
conflict error, in which case it gives up.

Cheers, Leo

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )