[Zope-Checkins] CVS: Zope/lib/python/Products/ZReST - ZReST.py:1.7

Andreas Jung andreas@andreas-jung.com
Sun, 6 Jul 2003 06:44:46 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZReST
In directory cvs.zope.org:/tmp/cvs-serv8091/lib/python/Products/ZReST

Modified Files:
	ZReST.py 
Log Message:
     - Collector #628: Applied patch to fix several textarea resize
       problems.


=== Zope/lib/python/Products/ZReST/ZReST.py 1.6 => 1.7 ===
--- Zope/lib/python/Products/ZReST/ZReST.py:1.6	Sat Feb 22 02:08:12 2003
+++ Zope/lib/python/Products/ZReST/ZReST.py	Sun Jul  6 06:44:11 2003
@@ -121,14 +121,18 @@
     }
     def _er(self, data, SUBMIT, dtpref_cols, dtpref_rows, REQUEST):
         dr,dc = self._size_changes[SUBMIT]
-        rows=max(1,int(dtpref_rows)+dr)
-        cols=max(40,int(dtpref_cols)+dc)
-        e=(DateTime('GMT') + 365).rfc822()
-        resp=REQUEST['RESPONSE']
-        resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
-        resp.setCookie('dtpref_cols',str(cols),path='/',expires=e)
-        return self.manage_main(self, REQUEST, __str__=self.quotedHTML(data),
-            dtpref_cols=cols, dtpref_rows=rows)
+        rows = str(max(1, int(dtpref_rows) + dr))
+        cols = str(dtpref_cols)
+        if cols.endswith('%'):
+           cols = str(min(100, max(25, int(cols[:-1]) + dc))) + '%'
+        else:
+           cols = str(max(35, int(cols) + dc))
+        e = (DateTime("GMT") + 365).rfc822()
+        setCookie = REQUEST["RESPONSE"].setCookie
+        setCookie("dtpref_rows", rows, path='/', expires=e)
+        setCookie("dtpref_cols", cols, path='/', expires=e)
+        REQUEST.other.update({"dtpref_cols":cols, "dtpref_rows":rows})
+        return self.manage_main(self, REQUEST, __str__=self.quotedHTML(data))
     security.declarePrivate('quotedHTML')
     def quotedHTML(self,
                    text=None,