Changeset 115
- Timestamp:
- 08/03/07 13:49:42
- Files:
-
- trunk/geniusql/logic.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/geniusql/logic.py
r114 r115 249 249 """Expression(func, [kwtypes={}]). func(obj, [**kw]) must return bool. 250 250 251 func: a function, with one positional argand optional keyword args,251 func: a function, with positional args and optional keyword args, 252 252 which must return bool. If func is None, it is initialized to 253 253 "lambda x: True". … … 260 260 """ 261 261 if func is None: 262 self.func = lambda x: True 262 func = lambda x: True 263 self._load_func(func, False) 263 264 else: 264 if earlybind: 265 self._load_func(func) 266 else: 267 self.func = func 268 269 # I can't believe this actually works (knock on wood). 270 self.func.func_globals.update(builtins) 265 self._load_func(func, earlybind) 271 266 272 267 if kwtypes is None: … … 275 270 self.kwargs = {} 276 271 277 def _load_func(self, func ):272 def _load_func(self, func, earlybind=True): 278 273 # I can't believe this actually works (knock on wood). 279 274 func.func_globals.update(builtins) 280 # Early-bind as much as possible. 281 binder = codewalk.EarlyBinder(func) 282 self.func = binder.function() 275 if earlybind: 276 # Early-bind as much as possible. 277 binder = codewalk.EarlyBinder(func) 278 self.func = binder.function() 279 else: 280 self.func = func 283 281 284 282 def code(self):
