def commit_tokens(self, updates=None, deletes=None): updates = updates if updates is not None else [] deletes = deletes if deletes is not None else [] for token in updates: token_model = ActiveTokenModel.from_token(token) token_model.save() for token in deletes: token_model = ActiveTokenModel.from_token(token) token_model.delete()
def archive_tokens(self, tokens): for token in tokens: active_token_model = ActiveTokenModel.from_token(token) active_token_model.delete() archived_token_model = ArchivedTokenModel.from_token(token) archived_token_model.save()