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

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


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

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


=== Zope/lib/python/Products/ZReST/ZReST.py 1.6 => 1.6.12.1 ===
--- 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:47:42 2003
@@ -52,7 +52,9 @@
         self.title = id
         self.stylesheet = 'default.css'
         self.report_level = '2'
-        self.source = self.formatted = ''
+        self.source = 'Text goes here....'
+        self.formatted = 'blbla'
+        print self.source
         self.input_encoding = 'iso-8859-15'
         self.output_encoding = 'iso-8859-15'
 
@@ -121,14 +123,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,