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

Leonardo Rochael Almeida leo@hiper.com.br
10 Dec 2002 18:10:02 -0200


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

On Tue, 2002-12-10 at 13:07, Dmitry Vasiliev wrote:
> 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: /cvs-repository/Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py,v
> retrieving revision 1.44
> diff -u -r1.44 ZopePageTemplate.py
> --- ZopePageTemplate.py	18 Sep 2002 15:12:46 -0000	1.44
> +++ ZopePageTemplate.py	10 Dec 2002 14:33:43 -0000
> @@ -155,8 +155,11 @@
>              cols = min(cols, 100) # Max width 100%
>              cols = "%d%%" % cols # Add percent sign back on
>          else: # Absolute width
> -            try: cols = int(width)
> -            except: cols = max(40, int(dtpref_cols) + szchw.get(width, 0))
> +            try:
> +                cols = int(width)
> +            except:
> +                cols = max(40, int(dtpref_cols[:-1]) + szchw.get(width, 0))
> +                cols = "%d%%" % cols # Add percent sign back on
>  
>          try: rows = int(height)
>          except: rows = max(1, int(dtpref_rows) + szchh.get(height, 0))
-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.