it's actually not web2py, but the db adapter ..... Also, it would be a lot easier without having to taking into account the first interpolation (payback_types = ('s','p')) .
In that case you can use the simple %(name)s notation with dict as placeholders parameter, or the positional one with simple %s and a tuple as placeholders parameter