I often use code of this form:
object.attribute=object.attribute=="forbidden value"? object.attribute:"allowed value";