[Zope] MySQL timestamp issue

Hugo Ramos ramosh at gmail.com
Fri Jun 3 05:33:37 EDT 2005


I already know what exactly makes Zope hang!
The problem is located at times.py that was installed by MySQL-Python
1.2.0 (MySQL-python.exe-1.2.0.win32-py2.4.zip)

==============OLD==============
def mysql_timestamp_converter(s):
    """Convert a MySQL TIMESTAMP to a Timestamp object."""
    s = s + "0"*(14-len(s)) # padding
    parts = map(int, filter(None, (s[:4],s[4:6],s[6:8],
                                   s[8:10],s[10:12],s[12:14])))
    try: return apply(Timestamp, tuple(parts))
    except: return None
==============OLD==============

============HACKED============
import DateTime

def mysql_timestamp_converter(s):
    """Convert a MySQL TIMESTAMP to a Timestamp object."""
    s = s + "0"*(14-len(s)) # padding
    parts = map(int, filter(None, (s[:4],s[4:6],s[6:8],
                                   s[8:10],s[10:12],s[12:14])))
    try: return apply(DateTime.DateTime, tuple(parts))
    except: return None
============HACKED============

Oren Goldschmidt helped me here and we just made a very nasty hack...
As you can see we imported DateTime and replaced the Timestamp inside
the try statement.

This makes Zope behave!!! But it's a nasty hack that could break other
stuff around there.

Comments???


Cheers
Hugo



On 6/3/05, Chris Withers <chris at simplistix.co.uk> wrote:
> Hugo Ramos wrote:
> > Could anyone explain me why this works in Zope 2.7.0 final and doesn't
> > work in Zope 2.7.6 final and/or 2.8.0b1 ??????
> 
> If Zope is really hanging, look at DeadlockDebugger and find out where
> it's hanging...
> 
> Chris
> 
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
> 
> 


-- 
Hugo Ramos - ramosh at gmail.com


More information about the Zope mailing list