Re: [Zope] MySQL timestamp issue
Yellow Andy, In fact what you've said works! That line was missing on db.py and after I inserted it there everything works the right way. I guess this thread is now over. Thanks!!! Cheers Hugo On 6/3/05, Andy Dustman <[EMAIL PROTECTED]> wrote: > On 6/3/05, Hugo Ramos <[EMAIL PROTECTED]> wrote: > > Yellow, > > > > I wrote the wrong version. > > I'm using MySQL 4.0.24 + Zope 276 + mysql-python 1.0.0 + ZMySQLDA 2.0.9b3 > > Take a look at ZMySQLDA/db.py: > > http://cvs.sourceforge.net/viewcvs.py/mysql-python/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py?rev=1.21&view=auto > > You may need to add a line like this to the DB class: > > conv[FIELD_TYPE.TIMESTAMP] = _mysql_timestamp_converter > > Not sure why this is missing. > > -- > Computer interfaces should never be made of meat. > http://www.terrybisson.com/meat.html > -- Hugo Ramos - [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] MySQL timestamp issue
On 6/3/05, Hugo Ramos <[EMAIL PROTECTED]> wrote: > Yellow, > > I wrote the wrong version. > I'm using MySQL 4.0.24 + Zope 276 + mysql-python 1.0.0 + ZMySQLDA 2.0.9b3 Take a look at ZMySQLDA/db.py: http://cvs.sourceforge.net/viewcvs.py/mysql-python/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py?rev=1.21&view=auto You may need to add a line like this to the DB class: conv[FIELD_TYPE.TIMESTAMP] = _mysql_timestamp_converter Not sure why this is missing. -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] MySQL timestamp issue
Yellow, I wrote the wrong version. I'm using MySQL 4.0.24 + Zope 276 + mysql-python 1.0.0 + ZMySQLDA 2.0.9b3 This is the DTML code generating the error: docdataemissao is a timestamp field in a table like: 200406011023 The traceback: Error Type: ValueError Error Value: unsupported format character 'Y' (0x59) at index 1 [...] Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_In, line 703, in renderwob Module DocumentTemplate.DT_Var, line 280, in render __traceback_info__: ('docdataemissao', , {'': 'docdataemissao', 'fmt': '%Y-%m-%d'}) Any ideas??? Cheers Hugo On 6/3/05, Andy Dustman <[EMAIL PROTECTED]> wrote: > On 6/3/05, Hugo Ramos <[EMAIL PROTECTED]> wrote: > > 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) > > This is a package for Python-2.4. Are you using Python-2.4 with > Zope-2.7? If you are, the line of people prepared to yell at you is > long and distinquished. > > What version of ZMySQLDA are you using? Only 2.0.9b3 will work > properly with MySQLdb-1.2.0. > -- > Computer interfaces should never be made of meat. > http://www.terrybisson.com/meat.html > -- Hugo Ramos - [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] MySQL timestamp issue
On 6/3/05, Hugo Ramos <[EMAIL PROTECTED]> wrote: > 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) This is a package for Python-2.4. Are you using Python-2.4 with Zope-2.7? If you are, the line of people prepared to yell at you is long and distinquished. What version of ZMySQLDA are you using? Only 2.0.9b3 will work properly with MySQLdb-1.2.0. -- Computer interfaces should never be made of meat. http://www.terrybisson.com/meat.html ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] MySQL timestamp issue
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 <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] MySQL timestamp issue
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 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] MySQL timestamp issue
Yellow, 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 ?? also when I try this: Zope hangs!!! ps: timestampvar is a timestamp var comming from MySQL 4.0.24 tia -- Hugo Ramos - [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )