Replace method attr in vars() to hasattr

As ChangBo Guo(gcb) said in review
https://review.openstack.org/#/c/359786,
'hasattr' has less cost than 'vars'.

Repair it in another place.

Change-Id: Ib13767be8377f536a9d82e54a6e7af8b6a8a1604
This commit is contained in:
JingLiu 2016-12-22 17:37:36 +08:00
parent bdb5a07627
commit 90399f9fe9
1 changed files with 1 additions and 1 deletions

View File

@ -1416,7 +1416,7 @@ class LogConfigTestCase(BaseTestCase):
super(LogConfigTestCase, self).setUp()
names = self.create_tempfiles([('logging', MIN_LOG_INI)])
self.log_config_append = names[0]
if 'old_time' in vars(log._load_log_config):
if hasattr(log._load_log_config, 'old_time'):
del log._load_log_config.old_time
def test_log_config_append_ok(self):