Merge "Clean hacking errors in advance of hacking update"
This commit is contained in:
commit
d695d4a3cd
@ -23,18 +23,23 @@ def check_length(property_name, value, min_length=1, max_length=64):
|
||||
msg = _("%s cannot be empty.") % property_name
|
||||
else:
|
||||
msg = (_("%(property_name)s cannot be less than "
|
||||
"%(min_length)s characters.")) % locals()
|
||||
"%(min_length)s characters.") % dict(
|
||||
property_name=property_name, min_length=min_length))
|
||||
raise exception.ValidationError(msg)
|
||||
if len(value) > max_length:
|
||||
msg = (_("%(property_name)s should not be greater than "
|
||||
"%(max_length)s characters.")) % locals()
|
||||
"%(max_length)s characters.") % dict(
|
||||
property_name=property_name, max_length=max_length))
|
||||
|
||||
raise exception.ValidationError(msg)
|
||||
|
||||
|
||||
def check_type(property_name, value, expected_type, display_expected_type):
|
||||
if not isinstance(value, expected_type):
|
||||
msg = _("%(property_name)s is not a "
|
||||
"%(display_expected_type)s") % locals()
|
||||
msg = (_("%(property_name)s is not a "
|
||||
"%(display_expected_type)s") % dict(
|
||||
property_name=property_name,
|
||||
display_expected_type=display_expected_type))
|
||||
raise exception.ValidationError(msg)
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ class DbSync(BaseApp):
|
||||
package = importutils.import_module(package_name)
|
||||
repo_path = os.path.abspath(os.path.dirname(package.__file__))
|
||||
except ImportError:
|
||||
print _("This extension does not provide migrations.")
|
||||
print(_("This extension does not provide migrations."))
|
||||
exit(0)
|
||||
try:
|
||||
# Register the repo with the version control API
|
||||
@ -115,7 +115,7 @@ class DbVersion(BaseApp):
|
||||
repo_path = os.path.abspath(os.path.dirname(package.__file__))
|
||||
print(migration.db_version(repo_path))
|
||||
except ImportError:
|
||||
print _("This extension does not provide migrations.")
|
||||
print(_("This extension does not provide migrations."))
|
||||
exit(1)
|
||||
else:
|
||||
print(migration.db_version())
|
||||
|
@ -225,9 +225,9 @@ class S3TokenMiddlewareTestUtil(unittest.TestCase):
|
||||
def test_split_path_invalid_path(self):
|
||||
try:
|
||||
s3_token.split_path('o\nn e', 2)
|
||||
except ValueError, err:
|
||||
except ValueError as err:
|
||||
self.assertEquals(str(err), 'Invalid path: o%0An%20e')
|
||||
try:
|
||||
s3_token.split_path('o\nn e', 2, 3, True)
|
||||
except ValueError, err:
|
||||
except ValueError as err:
|
||||
self.assertEquals(str(err), 'Invalid path: o%0An%20e')
|
||||
|
@ -1398,7 +1398,7 @@ class SqlUpgradeTests(SqlMigrateBase):
|
||||
total = connection.execute("SELECT count(*) "
|
||||
"from information_schema.TABLES "
|
||||
"where TABLE_SCHEMA='%(database)s'" %
|
||||
locals())
|
||||
dict(database=database))
|
||||
self.assertTrue(total.scalar() > 0, "No tables found. Wrong schema?")
|
||||
|
||||
noninnodb = connection.execute("SELECT table_name "
|
||||
@ -1406,7 +1406,7 @@ class SqlUpgradeTests(SqlMigrateBase):
|
||||
"where TABLE_SCHEMA='%(database)s' "
|
||||
"and ENGINE!='InnoDB' "
|
||||
"and TABLE_NAME!='migrate_version'" %
|
||||
locals())
|
||||
dict(database=database))
|
||||
names = [x[0] for x in noninnodb]
|
||||
self.assertEqual(names, [],
|
||||
"Non-InnoDB tables exist")
|
||||
|
Loading…
x
Reference in New Issue
Block a user