Merge "Clarify conditional_update return types"

This commit is contained in:
Zuul 2021-11-19 16:30:20 +00:00 committed by Gerrit Code Review
commit 1daeeff7bd
2 changed files with 4 additions and 4 deletions

View File

@ -1935,7 +1935,7 @@ def conditional_update(context, model, values, expected_values, filters=(),
equivalent to read_deleted. equivalent to read_deleted.
:param project_only: Should the query be limited to context's project. :param project_only: Should the query be limited to context's project.
:param order: Specific order of fields in which to update the values :param order: Specific order of fields in which to update the values
:returns: Number of db rows that were updated. :returns: Boolean indicating whether db rows were updated.
""" """
return IMPL.conditional_update(context, model, values, expected_values, return IMPL.conditional_update(context, model, values, expected_values,
filters, include_deleted, project_only, filters, include_deleted, project_only,

View File

@ -412,9 +412,9 @@ class CinderPersistentObject(object):
mean in some cases that we have to reload the mean in some cases that we have to reload the
object from the database. object from the database.
:param order: Specific order of fields in which to update the values :param order: Specific order of fields in which to update the values
:returns: number of db rows that were updated, which can be used as a :returns: Boolean indicating whether db rows were updated.
boolean, since it will be 0 if we couldn't update the DB and It will be False if we couldn't update the DB and
1 if we could, because we are using unique index id. True if we could.
""" """
if 'id' not in self.fields: if 'id' not in self.fields:
msg = (_('VersionedObject %s does not support conditional update.') msg = (_('VersionedObject %s does not support conditional update.')