[DB-SIG] dbiDate - help urgently needed

Chris Cogdon chris at cogdon.org
Mon Jun 2 17:13:17 EDT 2003


On Monday, Jun 2, 2003, at 15:59 US/Pacific, Lloyd Kvam wrote:

> dbiDate is form the old 1.0 API
>
> http://www.python.org/topics/database/DatabaseAPI-2.0.html
> Python Database API v2.0
>
> It specifies using mx.DateTime for date time values.
>
>
> The Python language just recently evolved to unify tpyes and classes.
> >>> isinstance(1, int)
> 1
> >>> import mx.DateTime as DT
> >>> d = DT.Date(2003,6,2)
> >>> d
> <DateTime object for '2003-06-02 00:00:00.00' at 13dd310>
> >>> isinstance(d, DT.DateTime)
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> TypeError: isinstance() arg 2 must be a class or type
> >>> isinstance(d, DT.DateTimeType)
> 1
>
> Not all of the modules support isinstance in the way you would expect. 
>  So
> we will probably be using type(obj_reference) for a while longer.

Oh... I see what's happening there. The 'Date' as used above is 
actually a function which returns an instance of a DateTimeType, and 
not a class, as you might expect. DateTime is another such function. 
The output from 'd', which is obviously module-generated, is returning 
a misleading value.

Jeff... was the output you got from your code REALLY the output you saw?


-- 
    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL




More information about the DB-SIG mailing list