Re: [Zope-dev] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Dmitry Vasiliev
Casey Duncan wrote: On Tuesday 10 December 2002 03:14 pm, Guido van Rossum wrote: Can we get the same patch without the generic except:, please? the last thing I want is a database corruption caused by resizing the Edit box... Why would this particular except clause cause database

Re: [Zope-dev] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander
Guido van Rossum wrote: Can we get the same patch without the generic except:, please? snipped part about whether there could be database corruption int() happens to raise a bunch of different exceptions, and I think an unqualified except: clause is okay here (though it needs a comment). I

Re: [Zope-dev] BUG: ValueError while changing height of the template edit window

2002-12-11 Thread Casey Duncan
On Wednesday 11 December 2002 03:43 am, Dmitry Vasiliev wrote: Casey Duncan wrote: On Tuesday 10 December 2002 03:14 pm, Guido van Rossum wrote: Can we get the same patch without the generic except:, please? the last thing I want is a database corruption caused by resizing the Edit

Re: [Zope-dev] BUG: ValueError while changing height of the template edit window

2002-12-11 Thread Guido van Rossum
I saw try: int() except: pattern in many places through all the Zope code. I think catching ValueError only does the job, but then we should replace it in all the places. :-) Yes, catching ValueError is sufficient for string conversions to int. I thought you could get an OverflowError, but

Re: [Zope-dev] BUG: ValueError while changing height of the template edit window

2002-12-11 Thread Guido van Rossum
I think this would be a useful note for the Zope3 style guide. What exceptions can int() raise? On converting a preexisting value to an int: ValueError, OverflowError, TypeError, AttributeError (Any others?) On converting an instance that implements __int__: Anything

[Zope-dev] Guido van Rossum: Re: [ZODB-Dev] Fwd: [Zope3-dev] directory hierarchy proposal (MartijnFaassen)

2002-12-11 Thread Guido van Rossum
Sorry, cc'ed the wrong list. :-( --- Forwarded Message Date:Wed, 11 Dec 2002 10:29:12 -0500 From:Guido van Rossum [EMAIL PROTECTED] To: [EMAIL PROTECTED] (Jeremy Hylton) cc: [EMAIL PROTECTED] Subject: Re: [ZODB-Dev] Fwd: [Zope3-dev] directory hierarchy proposal (Martijn

Re: [Zope-dev] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander
Anything can raise MemoryError. Ok. But I don't think regular application code should catch these. On converting an 8bit string to an int: ValueError *only* Ok. On converting a Unicode string to an int: ValueError UnicodeError (or UnicodeEncodeError, which is a subclass

Re: [Zope-dev] BUG: ValueError while changing height of the template edit window

2002-12-11 Thread Guido van Rossum
Anything can raise MemoryError. Ok. But I don't think regular application code should catch these. Correct. On converting an 8bit string to an int: ValueError *only* Ok. On converting a Unicode string to an int: ValueError UnicodeError (or

Re: [Zope-dev] Infuriating ZClass registry Heisenbug

2002-12-11 Thread Evan Simpson
Shane Hathaway wrote: Shot in the dark #2: Does it enter the ClassFactory function in Zope.ClassFactory? That's part of the ZClass magic... although there are two ways that the pickler tries to load classes. ZODB only tries to load Persistent instances as ZClasses. If there are things

Re: [Zope-dev] BUG: ValueError while changing height of the template edit window

2002-12-11 Thread Guido van Rossum
Can you provide an example of raising a unicode error like this: u = makeUnicodeString() # your choice of function int(u) In Python 2.3, I get this: int(u\u1234) Traceback (most recent call last): File stdin, line 1, in ? UnicodeEncodeError: 'decimal' codec

Re: [Zope-dev] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander
I spoke too soon. UnicodeEncodeError is a subclass of ValueError. So catching ValueError from int(str_or_unicode) is the way to go. Who's writing that Zope 3 style guide again? Great. http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZopePythonStyleGuide -- Steve Alexander

[Zope-dev] zope book volunteering

2002-12-11 Thread Chris McDonough
I am incredibly happy to report that many folks are signing up to edits chapters of the Zope Book in preparation for the upcoming Zope 2.6.1 release! It's really beating the cynicism out of me! ;-) As a matter of fact, so many people are signing up that I'm getting *multiple* submissions of the

Re: [Zope-dev] zope book volunteering

2002-12-11 Thread Chris McDonough
On Wed, 2002-12-11 at 20:14, Chris McDonough wrote: Here are the chapters in the 2.6 edition of the Zope Book ( http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/index_html ) that are not yet spoken for: Maintaining Zope Extending Zope (ZClasses) Advanced DTML Searching and

Re: [Zope-dev] Infuriating ZClass registry Heisenbug

2002-12-11 Thread Evan Simpson
More data: It may well be loading correctly, but it seems to be storing incorrectly. I managed to grab the ZGlobals pickle string, and it has the _zclass_ stored as a plain class instead of an oid. I copied the commented-out Python persistent_id() in ZODB/Connections.py into a method called

Re: [Zope-dev] Infuriating ZClass registry Heisenbug

2002-12-11 Thread Evan Simpson
I think I've fixed my ZGlobals, but there's definitely a problem in coptimizations. I made Connections.py use the Python persistent_id, restarted twice, and ZGlobals was fine on the second restart. Whew, Evan @ 4-am ___ Zope-Dev maillist -

Re: [Zope-dev] Infuriating ZClass registry Heisenbug

2002-12-11 Thread Shane Hathaway
On Wed, 11 Dec 2002, Evan Simpson wrote: I think I've fixed my ZGlobals, but there's definitely a problem in coptimizations. I made Connections.py use the Python persistent_id, restarted twice, and ZGlobals was fine on the second restart. Ah-ha, you now have a reproducible test case. The

Re: [Zope-dev] Infuriating ZClass registry Heisenbug

2002-12-11 Thread Casey Duncan
On Wednesday 11 December 2002 11:13 pm, Shane Hathaway wrote: On Wed, 11 Dec 2002, Evan Simpson wrote: I think I've fixed my ZGlobals, but there's definitely a problem in coptimizations. I made Connections.py use the Python persistent_id, restarted twice, and ZGlobals was fine on the