The second instance in that code of converting params into a tuple is erroneous (if params is a dictionary, it should not be converted into a tuple). As a result, string interpolation using the %(name)s syntax fails in debug mode.