Merge "Remove property message for DBInvalidUnicodeParameter and InvalidSortKey"

This commit is contained in:
Zuul 2017-10-19 06:59:19 +00:00 committed by Gerrit Code Review
commit 128e5438b1
2 changed files with 0 additions and 25 deletions

View File

@ -43,7 +43,6 @@ with `try/except` statement. This is required for consistent handling of
database errors.
"""
import debtcollector.removals
import six
from oslo_db._i18n import _
@ -188,13 +187,6 @@ class DBInvalidUnicodeParameter(Exception):
without encoding directive.
"""
@debtcollector.removals.removed_property
def message(self):
# NOTE(rpodolyaka): provided for compatibility with python 3k, where
# exceptions do not have .message attribute, while we used to have one
# in this particular exception class. See LP #1542961 for details.
return str(self)
def __init__(self):
super(DBInvalidUnicodeParameter, self).__init__(
_("Invalid Parameter: Encoding directive wasn't provided."))
@ -221,10 +213,6 @@ class DBMigrationError(DbMigrationError):
super(DBMigrationError, self).__init__(message)
debtcollector.removals.removed_class(DbMigrationError,
replacement=DBMigrationError)
class DBConnectionError(DBError):
"""Wrapped connection specific exception.
@ -250,13 +238,6 @@ class DBNotSupportedError(DBError):
class InvalidSortKey(Exception):
"""A sort key destined for database query usage is invalid."""
@debtcollector.removals.removed_property
def message(self):
# NOTE(rpodolyaka): provided for compatibility with python 3k, where
# exceptions do not have .message attribute, while we used to have one
# in this particular exception class. See LP #1542961 for details.
return str(self)
def __init__(self, key=None):
super(InvalidSortKey, self).__init__(
_("Sort key supplied is invalid: %s") % key)

View File

@ -205,17 +205,11 @@ class TestPaginateQuery(test_base.BaseTestCase):
str(exception.InvalidSortKey()))
self.assertEqual("Sort key supplied is invalid: lol",
str(exception.InvalidSortKey("lol")))
self.assertEqual("Sort key supplied is invalid: lol",
exception.InvalidSortKey("lol").message)
def test_invalid_unicode_paramater_str(self):
self.assertEqual(
"Invalid Parameter: Encoding directive wasn't provided.",
str(exception.DBInvalidUnicodeParameter()))
self.assertEqual(
"Invalid Parameter: Encoding directive wasn't provided.",
exception.DBInvalidUnicodeParameter().message
)
def test_paginate_query_attribute_error(self):
sqlalchemy.asc(self.model.user_id).AndReturn('asc')