[ZPT] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.39
Guido van Rossum
guido@python.org
Mon, 20 May 2002 16:40:38 -0400
Update of /cvs-repository/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv22262
Modified Files:
ZopePageTemplate.py
Log Message:
pt_changePrefs(): the dtprefs_cols/rows arguments could be expressed
in percentages; strip the percent sign to avoid a traceback calling
int() when these variables are used.
=== Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.38 => 1.39 ===
dtpref_cols='50', dtpref_rows='20'):
"""Change editing preferences."""
+ # The <textarea> can have dimensions expressed in percentages;
+ # strip the percent sign so int() below won't fail
+ if dtpref_cols[-1:] == "%":
+ dtpref_cols = dtpref_cols[:-1] or '50'
+ if dtpref_rows[-1:] == "%":
+ dtpref_rows = dtpref_rows[:-1] or '20'
szchh = {'Taller': 1, 'Shorter': -1, None: 0}
szchw = {'Wider': 5, 'Narrower': -5, None: 0}
try: rows = int(height)