[Zope-dev] y2k

Martijn Pieters mj@antraciet.nl
Wed, 26 May 1999 11:54:12 +0200


At 09:42 22/05/99 , Rod. wrote:
>heyas :)
>
>I hope this is the right place to ask.. a thousand apologies in advance if 
>it isnt!
>My workplace uses Zope quite heavily for internal database work, and 
>management wants to know if its y2k compliant.
>
>I assumed it was (being so clevery designed, with a modern language like 
>python) but an official thumbs up from someone
>who is familliar with its internals would be most appreciated.
>
>Thankyou in advance,
>
>Rod.

I (and others) have found 1 Y2K bug (of a sort) in Zope 1.10.2 (and 
possibly earlier). The problem has not yet been solved in versions 
1.11.0pr1 and 2.0.0.a1.

Zope uses cookies to make the size of editing windows in DTML 
Methods/Documents and SQL Methods persistent.

These cookies are hardwired to expire on the change of the millenium, and 
will not be returned by your browser in the year 2000 and later. This is 
just a minor inconvenience, Zope will cntinue to work if your server does, 
see comments by others.

Here are two patches that solve these problems. They were made using 
version 1.10.2, but probably work on other versions. YMMV. They solve the 
problem by relating the expiring date of the cookie to the current date. 
Cookies now will expire one year after they have been set.

First, DTMLMethod.py:
*** lib/python/OFS/DTMLMethod.py~       Wed May 26 11:30:08 1999
--- lib/python/OFS/DTMLMethod.py        Wed May 26 11:30:54 1999
***************
*** 93,98 ****
--- 93,99 ----
   from PropertyManager import PropertyManager
   from AccessControl.Role import RoleManager
   from Acquisition import Explicit
+ from DateTime import DateTime
   import regex, Globals, sys


***************
*** 210,216 ****

           rows=max(1,atoi(dtpref_rows)+dr)
           cols=max(40,atoi(dtpref_cols)+dc)
!         e='Friday, 31-Dec-99 23:59:59 GMT'
           resp=REQUEST['RESPONSE']
           resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
           resp.setCookie('dtpref_cols',str(cols),path='/',expires=e)
--- 211,217 ----

           rows=max(1,atoi(dtpref_rows)+dr)
           cols=max(40,atoi(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)

And secondly, DA.py:
*** lib/python/Shared/DC/ZRDB/DA.py~    Wed May 26 11:33:00 1999
--- lib/python/Shared/DC/ZRDB/DA.py     Wed May 26 11:33:29 1999
***************
*** 179,185 ****

           rows=max(1,atoi(sql_pref__rows)+dr)
           cols=max(40,atoi(sql_pref__cols)+dc)
!         e='Friday, 31-Dec-99 23:59:59 GMT'
           resp=REQUEST['RESPONSE']
           resp.setCookie('sql_pref__rows',str(rows),path='/',expires=e)
           resp.setCookie('sql_pref__cols',str(cols),path='/',expires=e)
--- 179,185 ----

           rows=max(1,atoi(sql_pref__rows)+dr)
           cols=max(40,atoi(sql_pref__cols)+dc)
!         e=(DateTime.DateTime('GMT') + 365).rfc822()
           resp=REQUEST['RESPONSE']
           resp.setCookie('sql_pref__rows',str(rows),path='/',expires=e)
           resp.setCookie('sql_pref__cols',str(cols),path='/',expires=e)

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------