[Commits] (twl) Handle dates
commits at osafoundation.org
commits at osafoundation.org
Mon Aug 30 12:14:21 PDT 2004
Commit by: twl
Modified files:
chandler/repository/query/Query.py 1.7 1.8
Log message:
Handle dates
Remove debug print statements
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/query/Query.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.8
Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.7 chandler/repository/query/Query.py:1.8
--- chandler/repository/query/Query.py:1.7 Thu Aug 26 17:30:04 2004
+++ chandler/repository/query/Query.py Mon Aug 30 12:14:18 2004
@@ -1,12 +1,13 @@
-__revision__ = "$Revision: 1.7 $"
-__date__ = "$Date: 2004/08/27 00:30:04 $"
+__revision__ = "$Revision: 1.8 $"
+__date__ = "$Date: 2004/08/30 19:14:18 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
import repository.query.parser.QueryParser as QueryParser
import tools.timing
import sets
+import mx.DateTime.ISO
import logging
log = logging.getLogger("RepoQuery")
@@ -169,7 +170,7 @@
infix_fns = ['contains']
binary_fns = []
unary_ops = ['not']
- unary_fns = ['len']
+ unary_fns = ['date','len']
def infix_op(op, args):
"""
@@ -185,7 +186,10 @@
args = ast [2:][0]
log.debug("%s %s %s" % (tok, fn, args))
if fn in unary_fns and len(args) == 1:
- pred = "%s(%s)" % (fn, compile_predicate(args[0]))
+ if fn == 'date':
+ pred = "mx.DateTime.ISO.ParseDateTime(%s)" % compile_predicate(args[0])
+ else:
+ pred = "%s(%s)" % (fn, compile_predicate(args[0]))
elif fn in binary_fns and len(args) == 2:
pred = fn+'('+compile_predicate(args[0])+','+compile_predicate(args[1])+')'
elif fn in infix_fns:
@@ -246,7 +250,6 @@
represented by the AST.
(The AST is actually the list of arguments to 'union')
"""
- print ast
queries = [ self.__analyze(i) for i in ast[0] ]
return ('union', queries)
@@ -256,9 +259,7 @@
represented by the AST
(The AST is the two arguments to 'intersect')
"""
- print ast
queries = [ self.__analyze(i) for i in ast[0:2] ]
- print queries
return ('intersect', queries)
def analyze_difference(ast):
More information about the Commits
mailing list