[egenix-users] mxDateTime name conflict

M.-A. Lemburg mal at egenix.com
Mon Jan 12 16:36:20 CET 2009

On 2009-01-12 16:13, Ksenia Marasanova wrote:
> Hi list / developers,
> I've spent the most of this day solving a really weird problem with
> mx.DateTime module. In a web application I had a custom database type
> for SQLAlchemy:
> import sqlalchemy.types as types
> class mxDateTime(types.TypeDecorator):
>     pass    
>     # some code
> The problem was that every time after using this class (= updating a
> table that has a column of this type) the system time zone was magically
> changed from 'CET' to 'UTC':
> from mx import DateTime
> print DateTime.now().tz # prints 'CET'
> instance.created = DateTime.now()
> # now() is still correct
> # commit...
> # ...
> # ....
> from mx import DateTime
> print DateTime.now().tz
> # prints 'UTC'
> After renaming my class to "MXDateTime" the problem has disappeared! So
> I just want to report that naming a class mxDateTime will probably cause
> conflict with mx.DateTime internals.

We've never heard of such a problem before. I don't think it's related
to the naming of the class - unless SA does something really strange
behind the scenes.

Note that a change from CET to UTC is possible, if an application
changes the locale of the C lib. Some databases do this in order
to cope with problems related to differences in number representations.

This could result in the timezone to change as well.

BTW: Do the time values change accordingly ?

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Jan 12 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the egenix-users mailing list