Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 213

Show
Ignore:
Timestamp:
11/05/07 12:54:43
Author:
fumanchu
Message:

Fix for is_constant when the func has a docstring in co_consts (instead of None for no docstring).

Files:

Legend:

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

    r212 r213  
    267267        func: a function, with positional args and optional keyword args, 
    268268            which must return bool. If func is None, it is initialized to 
    269             "lambda x: True". 
     269            "lambda *args, **kwargs: True". If func is a dict, logic.filter 
     270            will be used to create an Expression from it. 
    270271        kwtypes: a dictionary of {keyword: type} pairs. 
    271272        earlybind: if True (the default), the given function will be 
     
    367368        """Return True if self.func == (lambda: value), False otherwise.""" 
    368369        fc = self.func.func_code 
    369         return fc.co_code == 'd\x01\x00S' and fc.co_consts == (None, value) 
     370        return (fc.co_code == 'd\x01\x00S' and 
     371                # i.e., fc.co_consts == (docstring or None, value) 
     372                len(fc.co_consts) == 2 and fc.co_consts[1] == value) 
    370373 
    371374