From 2f287ffdc024738729288fda1aa9fdcacdcb98f4 Mon Sep 17 00:00:00 2001 From: gengchc2 Date: Thu, 25 Aug 2016 14:20:00 +0800 Subject: [PATCH] Translate info-level log messages for LOG.warn The Log "LOG.warn(_LW(...)" is used in some places,but the log "LOG.warn(_(..))" still used in a few places. Change-Id: Ife3ce21190907386e69f78f97b9c601467016b89 --- bilean/db/sqlalchemy/api.py | 5 +++-- bilean/scheduler/cron_scheduler.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bilean/db/sqlalchemy/api.py b/bilean/db/sqlalchemy/api.py index 74698f9..300555c 100644 --- a/bilean/db/sqlalchemy/api.py +++ b/bilean/db/sqlalchemy/api.py @@ -26,6 +26,7 @@ from sqlalchemy.orm.session import Session from bilean.common import consts from bilean.common import exception from bilean.common.i18n import _ +from bilean.common.i18n import _LW from bilean.db.sqlalchemy import filters as db_filters from bilean.db.sqlalchemy import migration from bilean.db.sqlalchemy import models @@ -731,8 +732,8 @@ def action_acquire(context, action_id, owner, timestamp): return None if action.status != consts.ACTION_READY: - msg = _('The action is not in an executable status: ' - '%s') % action.status + msg = _LW('The action is not in an executable status: ' + '%s') % action.status LOG.warn(msg) return None action.owner = owner diff --git a/bilean/scheduler/cron_scheduler.py b/bilean/scheduler/cron_scheduler.py index 10041b1..e68935c 100644 --- a/bilean/scheduler/cron_scheduler.py +++ b/bilean/scheduler/cron_scheduler.py @@ -15,6 +15,7 @@ from bilean.common import context as bilean_context from bilean.common import exception from bilean.common.i18n import _ from bilean.common.i18n import _LI +from bilean.common.i18n import _LW from bilean.common import utils from bilean.db import api as db_api from bilean.engine import user as user_mod @@ -174,7 +175,7 @@ class CronScheduler(object): db_api.job_delete( admin_context, self._generate_job_id(user_id, task_type)) except exception.NotFound as e: - LOG.warn(_("Failed in deleting job: %s") % six.text_type(e)) + LOG.warn(_LW("Failed in deleting job: %s") % six.text_type(e)) def _add_notify_job(self, user): if user.rate == 0: @@ -240,7 +241,7 @@ class CronScheduler(object): self._remove_job(job_id) db_api.job_delete(admin_context, job_id) except Exception as e: - LOG.warn(_("Failed in deleting job: %s") % six.text_type(e)) + LOG.warn(_LW("Failed in deleting job: %s") % six.text_type(e)) if user.status == user.ACTIVE: self._add_notify_job(user) @@ -257,7 +258,7 @@ class CronScheduler(object): self._remove_job(job_id) db_api.job_delete(admin_context, job_id) except Exception as e: - LOG.warn(_("Failed in deleting job: %s") % six.text_type(e)) + LOG.warn(_LW("Failed in deleting job: %s") % six.text_type(e)) def list_opts():