Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 194

Show
Ignore:
Timestamp:
10/06/07 22:30:39
Author:
fumanchu
Message:

Oops.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/logic.py

    r193 r194  
    282282        else: 
    283283            if isinstance(func, dict): 
    284                 func = filter(**func) 
     284                func = _filter_func(**func) 
     285                earlybind = False 
    285286            self.func = func 
    286287            lp = astwalk.LambdaParser(func, env=builtins, reduce=earlybind) 
     
    369370 
    370371 
    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     """ 
     372def _filter_func(**kwargs): 
    379373    items = kwargs.items() 
    380374    co = [] 
     
    404398    co = CodeType(1, 1, 2, 67, ''.join(map(chr, co)), 
    405399                  consts, names, ('x', ), '', '<lambda>', 1, '') 
    406     func = FunctionType(co, {}) 
    407     return Expression(func, earlybind=False) 
     400    return FunctionType(co, {}) 
     401 
     402def 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) 
    408411 
    409412