Changeset 194
- Timestamp:
- 10/06/07 22:30:39
- Files:
-
- trunk/geniusql/logic.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/geniusql/logic.py
r193 r194 282 282 else: 283 283 if isinstance(func, dict): 284 func = filter(**func) 284 func = _filter_func(**func) 285 earlybind = False 285 286 self.func = func 286 287 lp = astwalk.LambdaParser(func, env=builtins, reduce=earlybind) … … 369 370 370 371 371 def filter(**kwargs): 372 """Form an Expression from keyword arguments. 373 374 Allows you to write: 375 e = logic.filter(a=3, b=1) 376 ...instead of: 377 e = logic.Expression(lambda x: x.a == 3 and x.b == 1) 378 """ 372 def _filter_func(**kwargs): 379 373 items = kwargs.items() 380 374 co = [] … … 404 398 co = CodeType(1, 1, 2, 67, ''.join(map(chr, co)), 405 399 consts, names, ('x', ), '', '<lambda>', 1, '') 406 func = FunctionType(co, {}) 407 return Expression(func, earlybind=False) 400 return FunctionType(co, {}) 401 402 def filter(**kwargs): 403 """Form an Expression from keyword arguments. 404 405 Allows you to write: 406 e = logic.filter(a=3, b=1) 407 ...instead of: 408 e = logic.Expression(lambda x: x.a == 3 and x.b == 1) 409 """ 410 return Expression(_filter_func(**kwargs), earlybind=False) 408 411 409 412
