Re: Some more questions

Sebastien Bigaret <[email protected]> 29 Feb 2004 14:20:24 +0100
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
"Ernesto Revilla" <[email protected]> wrote:
> Dear all,
> 
> * how do I query for DateTime fields?

Example:

    ec.fetch('Writer', 'birthday == "1939-10-27 08:31:15"')
or
    ec.fetch('Writer', 'birthday like "1939-10-27*"')

> * modeling validates mx.DateTime.DateTime and mx.DateTime.Date objects, but
> not mx.DateTime.Time. (efectively DateTimeDelta). Is it possible to handle
> these?

Yes it is: try the attached patch!

-- Sébastien.


------------------------------------------------------------------------
diff -u -r1.21 Attribute.py
--- Attribute.py        22 Feb 2004 17:31:37 -0000      1.21
+++ Attribute.py        29 Feb 2004 13:10:39 -0000
@@ -56,7 +56,7 @@
 # python
 import types, string, sys, time
 from cgi import escape
-from mx.DateTime import DateTime, DateFrom
+from mx.DateTime import DateTime, DateFrom, Time
 
 # Module constants
 # useless, should be dropped
@@ -76,7 +76,7 @@
 
 def date_types():
   "Returns the set of valid date types"
-  avail_types=[ type(DateTime(0)) ]
+  avail_types=[ type(DateTime(0)), type(Time(0)) ]
   try:
     import DCOracle2
     avail_types.append(type(DCOracle2.Date(0,0,0)))
------------------------------------------------------------------------



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click