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

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] 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

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

2002-12-10 Thread Dmitry Vasiliev
Hi All! Zope 2.6: pressing of Taller or Shorter buttons of the page template edit window raises ValueError. Patch attached. -- Dmitry Vasiliev (dima at hlabs.spb.ru) Index: ZopePageTemplate.py === RCS file:

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

2002-12-10 Thread Casey Duncan
Please submit a collector issue for this http://collector.zope.org/Zope so the patch doesn't get lost. Thanks. -Casey On Tuesday 10 December 2002 10:07 am, Dmitry Vasiliev wrote: Hi All! Zope 2.6: pressing of Taller or Shorter buttons of the page template edit window raises ValueError.

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

2002-12-10 Thread Guido van Rossum
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 corruption? int() happens to raise a bunch of different exceptions, and I think an

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

2002-12-10 Thread Casey Duncan
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 corruption? I think