Merge "Replace six.iteritems with dict.items"

This commit is contained in:
Jenkins 2017-04-04 20:01:12 +00:00 committed by Gerrit Code Review
commit 36039b4efa
3 changed files with 10 additions and 10 deletions

View File

@ -20,7 +20,7 @@ from oslo_config import cfg
from oslo_log import log
import pecan
from pecan import rest
import six
from six.moves.urllib import parse
from refstack import db
@ -57,7 +57,7 @@ class MetadataController(rest.RestController):
if role in (const.ROLE_FOUNDATION, const.ROLE_OWNER):
return test_info['meta']
elif role in (const.ROLE_USER):
return {k: v for k, v in six.iteritems(test_info['meta'])
return {k: v for k, v in test_info['meta'].items()
if k in self.rw_access_keys}
pecan.abort(403)
@ -130,7 +130,7 @@ class ResultsController(validation.BaseRestControllerWithValidation):
test_info['product_version'] = None
test_info['meta'] = {
k: v for k, v in six.iteritems(test_info['meta'])
k: v for k, v in test_info['meta'].items()
if k in MetadataController.rw_access_keys
}
return test_info
@ -230,7 +230,7 @@ class ResultsController(validation.BaseRestControllerWithValidation):
# Only show all metadata if the user is the owner or a
# member of the Foundation group.
result['meta'] = {
k: v for k, v in six.iteritems(result['meta'])
k: v for k, v in result['meta'].items()
if k in MetadataController.rw_access_keys
}
result.update({'url': parse.urljoin(

View File

@ -30,7 +30,7 @@ from oslo_utils import timeutils
import pecan
import pecan.rest
import jwt
import six
from six.moves.urllib import parse
from refstack import db
@ -336,7 +336,7 @@ def verify_openid_request(request):
'your name.',
}
for name, error in six.iteritems(required_parameters):
for name, error in required_parameters.items():
if name not in verify_params or not verify_params[name]:
pecan.abort(401, 'Authentication is failed. %s' % error)

View File

@ -24,7 +24,7 @@ from oslo_config import cfg
from oslo_db import options as db_options
from oslo_db.sqlalchemy import session as db_session
from oslo_log import log
import six
from refstack.api import constants as api_const
from refstack.db.sqlalchemy import models
@ -125,7 +125,7 @@ def store_results(results):
test_result.name = result['name']
test_result.uuid = result.get('uuid', None)
test.results.append(test_result)
for k, v in six.iteritems(results.get('meta', {})):
for k, v in results.get('meta', {}).items():
meta = models.TestMeta()
meta.meta_key, meta.value = k, v
test.meta.append(meta)
@ -610,7 +610,7 @@ def get_products(allowed_keys=None, filters=None):
filters = {}
expected_filters = ['public', 'organization_id']
filter_args = {}
for key, value in six.iteritems(filters):
for key, value in filters.items():
if key not in expected_filters:
raise Exception('Unknown filter key "%s"' % key)
filter_args[key] = value
@ -640,7 +640,7 @@ def get_products_by_user(user_openid, allowed_keys=None, filters=None):
.filter(models.UserToGroup.user_openid == user_openid))
expected_filters = ['organization_id']
for key, value in six.iteritems(filters):
for key, value in filters.items():
if key not in expected_filters:
raise Exception('Unknown filter key "%s"' % key)
query = query.filter(getattr(models.Product, key) ==