Merge "Backslash continuation removal (Keystone folsom-1)"

This commit is contained in:
Jenkins 2012-05-21 16:30:38 +00:00 committed by Gerrit Code Review
commit 33d107aa1d
4 changed files with 23 additions and 21 deletions

View File

@ -321,8 +321,8 @@ class UserApi(common_ldap.BaseLdap, ApiShimMixin):
self.role_api.rolegrant_delete(ref.id)
def get_by_email(self, email):
users = self.get_all('(mail=%s)' % \
(ldap_filter.escape_filter_chars(email),))
users = self.get_all('(mail=%s)' %
(ldap_filter.escape_filter_chars(email),))
try:
return users[0]
except IndexError:

View File

@ -176,9 +176,10 @@ class Identity(sql.Base, identity.Driver):
def get_tenant_users(self, tenant_id):
session = self.get_session()
user_refs = session.query(User)\
.join(UserTenantMembership)\
.filter(UserTenantMembership.tenant_id == tenant_id)\
.all()
.join(UserTenantMembership)\
.filter(UserTenantMembership.tenant_id ==
tenant_id)\
.all()
return [_filter_user(user_ref.to_dict()) for user_ref in user_refs]
def _get_user(self, user_id):
@ -256,8 +257,8 @@ class Identity(sql.Base, identity.Driver):
def get_tenants_for_user(self, user_id):
session = self.get_session()
membership_refs = session.query(UserTenantMembership)\
.filter_by(user_id=user_id)\
.all()
.filter_by(user_id=user_id)\
.all()
return [x.tenant_id for x in membership_refs]
def get_roles_for_user_and_tenant(self, user_id, tenant_id):
@ -329,11 +330,11 @@ class Identity(sql.Base, identity.Driver):
session = self.get_session()
user_ref = session.query(User).filter_by(id=user_id).first()
membership_refs = session.query(UserTenantMembership)\
.filter_by(user_id=user_id)\
.all()
.filter_by(user_id=user_id)\
.all()
metadata_refs = session.query(Metadata)\
.filter_by(user_id=user_id)\
.all()
.filter_by(user_id=user_id)\
.all()
with session.begin():
if membership_refs:
@ -378,11 +379,11 @@ class Identity(sql.Base, identity.Driver):
session = self.get_session()
tenant_ref = session.query(Tenant).filter_by(id=tenant_id).first()
membership_refs = session.query(UserTenantMembership)\
.filter_by(tenant_id=tenant_id)\
.all()
.filter_by(tenant_id=tenant_id)\
.all()
metadata_refs = session.query(Metadata)\
.filter_by(tenant_id=tenant_id)\
.all()
.filter_by(tenant_id=tenant_id)\
.all()
with session.begin():
if membership_refs:

View File

@ -76,9 +76,10 @@ class S3Token(object):
resp = webob.Response(content_type='text/xml')
resp.status = error_table[code][0]
resp.body = error_table[code][1]
resp.body = '<?xml version="1.0" encoding="UTF-8"?>\r\n<Error>\r\n ' \
'<Code>%s</Code>\r\n <Message>%s</Message>\r\n</Error>\r\n' \
% (code, error_table[code][1])
resp.body = ('<?xml version="1.0" encoding="UTF-8"?>\r\n'
'<Error>\r\n <Code>%s</Code>\r\n '
'<Message>%s</Message>\r\n</Error>\r\n' %
(code, error_table[code][1]))
return resp
def _json_request(self, creds_json):

View File

@ -73,8 +73,8 @@ class Token(sql.Base, token.Driver):
def delete_token(self, token_id):
session = self.get_session()
token_ref = session.query(TokenModel)\
.filter_by(id=token_id)\
.first()
.filter_by(id=token_id)\
.first()
if not token_ref:
raise exception.TokenNotFound(token_id=token_id)
@ -87,7 +87,7 @@ class Token(sql.Base, token.Driver):
tokens = []
now = datetime.datetime.utcnow()
for token_ref in session.query(TokenModel)\
.filter(TokenModel.expires > now):
.filter(TokenModel.expires > now):
token_ref_dict = token_ref.to_dict()
if 'user' not in token_ref_dict:
continue