On Fri, 2004-12-10 at 01:14 +0100, Martin Virtel wrote:
> Hi, I'm using WebKit 0.81 on Debian Linux. It works fine with Python up
> to 2.2.2, but I get an error *in the generated Python code* from
> MiddleKit with 2.3 on every MiddleKit Object that has an attribute of
> type datetime. I'm using mx.DateTime, the generated code works fine with
> 2.2.2.
> Traceback (most recent call last):
> File "<pyshell#28>", line 1, in -toplevel-
> g=store.fetchObjectsOfClass("User")
> File "MiddleKit/Run/SQLObjectStore.py", line 298, in fetchObjectsOfClass
> File "MiddleKit/Run/MiddleObject.py", line 90, in readStoreData
> File "/usr/local/bottino/src/Proxy/GeneratedPy/GenUser.py", line 205,
> in setLastlogin
> raise TypeError, 'expecting datetime type, but got value %r of type
> %r instead' % (value, type(value))
> TypeError: expecting datetime type, but got value
> datetime.datetime(2004, 12, 10, 0, 32, 21) of type <type
> 'datetime.datetime'> instead
Hi Martin,
Which database adapter and version do you have installed? It appears that
your database adapter is returning date fields from the database using
the 'datetime' type (new in python 2.3) instead of the 'mx.DateTime'
type which MiddleKit expects.
In fact I've just had a look, and the most recent python2.3-mysqldb does
exactly this. It still has support for mx.DateTime, but was recently
changed to use the datetime types by default. Unfortunately the
author doesn't appear to have made this configurable (this is probably
worthy of a bug report), so you might need to either change the source
(MySQLdb/times.py, swap around the pytimes and mxdatetimes import
statements), or downgrade to an older package (at least until MiddleKit
supports datetime).
At any rate, I use MiddleKit and Python 2.3 on Debian, and it works. My
adapters are:
python-mysqldb 0.9.2-0.4
python2.3-psycopg 1.1.9-2
peace,
Jason
|