Added better test for failed attribute write

Failing to write the attribute is a serious problem with db or patron,
so we raise exception instead of simply returning false.