def set_callback(self, callback): if callback != OUT_OF_BAND: # out of band, says "we can't do this!" if check_valid_callback(callback): self.callback = callback self.callback_confirmed = True self.save() else: raise oauth.Error('Invalid callback URL.')