Fix doc build errors with SQLAlchemy 0.9

The docs failed to build when using SQLAlchemy 0.9. The following
errors occur:

 sphinx.errors.SphinxWarning:
 /opt/stack/keystone/keystone/common/sql/__init__.py:docstring of
 keystone.common.sql.relationship:53: ERROR: Unknown interpreted text
 role "paramref".

To fix this, relationship was removed from keystone.common.sql. It
was a reference to the same in sqlalchemy.orm, so the user was
changed to use sqlalchemy.orm.relationship.

 sphinx.errors.SphinxWarning:
 /opt/stack/keystone/keystone/openstack/common/db/sqlalchemy/utils.py:
 docstring of keystone.openstack.common.db.sqlalchemy.utils.or_:26:
 WARNING: more than one target found for cross-reference u'and_':
 keystone.common.sql.core.and_, keystone.common.sql.and_

To fix this, and_ was removed from keystone.common.sql. It was a
reference to the same in sqlalchemy, so the users were changed to use
sqlalchemy.and_.

Closes-Bug: #1296333
Change-Id: I39a91a5a30d351c4538d437c7584544bdb59c65e
This commit is contained in:
Brant Knudson 2014-03-23 11:55:59 -05:00
parent 7a9bd0e04f
commit 3d2a715025
3 changed files with 5 additions and 5 deletions

View File

@ -13,6 +13,7 @@
# under the License.
import six
import sqlalchemy
from keystone import assignment
from keystone import clean
@ -291,7 +292,7 @@ class Assignment(assignment.Driver):
else:
raise AttributeError(_("Must specify either domain or project"))
sql_constraints = sql.and_(
sql_constraints = sqlalchemy.and_(
RoleAssignment.type == assignment_type,
RoleAssignment.target_id == target_id,
Role.id == RoleAssignment.role_id,
@ -309,7 +310,7 @@ class Assignment(assignment.Driver):
else:
assignment_type = AssignmentType.GROUP_PROJECT
group_sql_conditions = sql.and_(
group_sql_conditions = sqlalchemy.and_(
RoleAssignment.type == assignment_type,
entity.id == RoleAssignment.target_id,
RoleAssignment.actor_id.in_(group_ids))

View File

@ -14,6 +14,7 @@
# under the License.
import six
import sqlalchemy
from keystone import catalog
from keystone.catalog import core
@ -58,7 +59,7 @@ class Service(sql.ModelBase, sql.DictBase):
id = sql.Column(sql.String(64), primary_key=True)
type = sql.Column(sql.String(255))
extra = sql.Column(sql.JsonBlob())
endpoints = sql.relationship("Endpoint", backref="service")
endpoints = sqlalchemy.orm.relationship("Endpoint", backref="service")
class Endpoint(sql.ModelBase, sql.DictBase):

View File

@ -59,11 +59,9 @@ Boolean = sql.Boolean
Text = sql.Text
UniqueConstraint = sql.UniqueConstraint
PrimaryKeyConstraint = sql.PrimaryKeyConstraint
relationship = sql.orm.relationship
joinedload = sql.orm.joinedload
# Suppress flake8's unused import warning for flag_modified:
flag_modified = flag_modified
and_ = sql.and_
def initialize():