Hi, found and worked around a problem with DataBase.

Problem

<<DataBase(source, headers)>>
<<DataBase(source, headers, "query")>>

headers is always evaluated as true. The args and the resulting header variable are strings, and python (apparently) won't automatically coerce strings into booleans, so 'False' or '0' are actually considered true values (as opposed to False and 0, which are false). Even putting '' in doesn't result in a false statement. It results in a string like '\'\''.

Work Around

My work around was to edit DataBase.py and put

    if header.isdigit():
        header = int(header)

Before header is evaluated. Then at least 0 can evaluate to false ('0' still evaluates to true).

Solution

Some sort of real string_to_bool() function or feature should be used. I don't know enough python to know if one already exists.

Contact Me

Thanks! <SPAMLESS dmartin AT seattlecentral NOSPMAPAM DOT edu>

MoinMoin: MacroMarket/DataBase/Bugs/headerAndBool (last edited 2008-02-29 20:27:47 by DylanMartin)