def _migrate_old_token_name(self, app_name): """Migrate credentials with old name, store them with new name.""" logger.debug("Migrating old token name.") attr = self._get_keyring_attr(app_name) attr['token-name'] = get_old_token_name(app_name) item = yield self._find_keyring_item(app_name, attr=attr) if item is not None: yield self.set_credentials(app_name, dict(parse_qsl(item.secret))) yield item.delete() result = yield self._find_keyring_item(app_name) returnValue(result)
def _migrate_old_token_name(self, app_name): """Migrate credentials with old name, store them with new name.""" logger.debug("getting keyring attr") attr = self._get_keyring_attr(app_name) logger.debug("getting old token name") attr['token-name'] = get_old_token_name(app_name) logger.debug("finding keyring item") item = yield self._find_keyring_item(app_name, attr=attr) if item is not None: logger.debug("setting credentials") yield self.set_credentials(app_name, dict(urlparse.parse_qsl(item.secret))) logger.debug("deleting old item") yield item.delete() logger.debug("finding keyring item") result = yield self._find_keyring_item(app_name) logger.debug("returning result value") returnValue(result)