[Commits] (twl) Add support for method invocation in predicates. Activate

commits at osafoundation.org commits at osafoundation.org
Mon Aug 23 12:42:15 PDT 2004


Commit by: twl
Modified files:
chandler/repository/query/Query.py 1.1 1.2

Log message:
Add support for method invocation in predicates.  Activate
hasAttribute method for Stuart


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/query/Query.py.diff?r1=text&tr1=1.1&r2=text&tr2=1.2

Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.1 chandler/repository/query/Query.py:1.2
--- chandler/repository/query/Query.py:1.1	Fri Aug 20 14:05:12 2004
+++ chandler/repository/query/Query.py	Mon Aug 23 12:42:14 2004
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.1 $"
-__date__      = "$Date: 2004/08/20 21:05:12 $"
+__revision__  = "$Revision: 1.2 $"
+__date__      = "$Date: 2004/08/23 19:42:14 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -190,6 +190,11 @@
             elif ast[0] == 'path': # path expression
                 #@@@ do iteration variable checks
                 return '.'.join(ast[1])
+            elif ast[0] == 'method':
+                path = ast[1]
+                args = ast[2]
+                #@@@ check method name against approved list
+                return  '.'.join(path[1])+"("+','.join(args)+")"
             elif type(ast) == str or type(ast) == unicode: # string constant or iteration variable or parameter ($1)
                 #@@@ check that ast != iteration variable, or parameter
                 return ast
@@ -210,12 +215,12 @@
             iter_source = ast[1]
             predicate = ast[2]
 
-            self.__rep.logger.debug("analyze_for: var = %s, source = %s, predicate = %s" % (iter_var, iter_source, predicate))
+            log.debug("analyze_for: var = %s, source = %s, predicate = %s" % (iter_var, iter_source, predicate))
 
             collection = lookup_source(iter_source)
             closure = compile_predicate(predicate)
 
-            self.__rep.logger.debug("analyze_for: collection = %s, closure = %s" % (collection, closure))
+            log.debug("analyze_for: collection = %s, closure = %s" % (collection, closure))
             
             return ('for', (collection, compile(closure,'<string>','eval')))
 
@@ -228,7 +233,7 @@
             queries = [ self.__analyze(i) for i in ast[0] ]
             return ('union', queries)
 
-        self.__rep.logger.debug("__analyze %s" % ast)
+        log.debug("__analyze %s" % ast)
         op = ast[0]
 
         if op == 'for':
@@ -267,7 +272,7 @@
         @param: queries
         @type param: list (queries to union)
         """
-        self.__rep.logger.debug("__execute_union: plan=%s" % plans)
+        log.debug("__execute_union: plan=%s" % plans)
         
         #@@@ DANGER - hack for self._kind - fix with notification upgrade
         self._kind = None



More information about the Commits mailing list