Drop the usage of unicode prefix from unicode strings

All strings are considered as unicode strings in python 3,
so we no longer need "u" prefix (u'...').

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I796d2fcdca066475bbf29d25cbf2aa67b2b2178b
This commit is contained in:
YuehuiLei 2021-01-05 15:22:42 +08:00 committed by Tatiana Ovchinnikova
parent cb7038d07e
commit 87f498bee5
87 changed files with 832 additions and 835 deletions

View File

@ -106,7 +106,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
copyright = u'2012, OpenStack Foundation' copyright = '2012, OpenStack Foundation'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@ -235,8 +235,8 @@ htmlhelp_basename = 'Horizondoc'
# (source start file, target name, title, author, documentclass # (source start file, target name, title, author, documentclass
# [howto/manual]). # [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'doc-horizon.tex', u'Horizon Documentation', ('index', 'doc-horizon.tex', 'Horizon Documentation',
u'OpenStack Foundation', 'manual'), 'OpenStack Foundation', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -273,8 +273,8 @@ latex_use_xindy = False
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'horizon', u'Horizon Documentation', ('index', 'horizon', 'Horizon Documentation',
[u'OpenStack'], 1) ['OpenStack'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
@ -287,7 +287,7 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'Horizon', u'Horizon Documentation', u'OpenStack', ('index', 'Horizon', 'Horizon Documentation', 'OpenStack',
'Horizon', 'One line description of project.', 'Miscellaneous'), 'Horizon', 'One line description of project.', 'Miscellaneous'),
] ]
@ -304,10 +304,10 @@ texinfo_documents = [
# -- Options for Epub output -------------------------------------------------- # -- Options for Epub output --------------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
epub_title = u'Horizon' epub_title = 'Horizon'
epub_author = u'OpenStack' epub_author = 'OpenStack'
epub_publisher = u'OpenStack' epub_publisher = 'OpenStack'
epub_copyright = u'2012, OpenStack' epub_copyright = '2012, OpenStack'
# The language of the text. It defaults to the language option # The language of the text. It defaults to the language option
# or en if the language is not set. # or en if the language is not set.

View File

@ -114,7 +114,7 @@ class HorizonComponent(object):
% self.__class__) % self.__class__)
def __str__(self): def __str__(self):
name = getattr(self, 'name', u"Unnamed %s" % self.__class__.__name__) name = getattr(self, 'name', "Unnamed %s" % self.__class__.__name__)
return name return name
def _get_default_urlpatterns(self): def _get_default_urlpatterns(self):
@ -705,7 +705,7 @@ class Site(Registry, HorizonComponent):
urls = 'horizon.site_urls' urls = 'horizon.site_urls'
def __repr__(self): def __repr__(self):
return u"<Site: %s>" % self.slug return "<Site: %s>" % self.slug
@property @property
def _conf(self): def _conf(self):

View File

@ -243,7 +243,7 @@ class SelectWidget(widgets.Widget):
def render_option(self, selected_choices, option_value, option_label): def render_option(self, selected_choices, option_value, option_label):
option_value = force_text(option_value) option_value = force_text(option_value)
other_html = (u' selected="selected"' other_html = (' selected="selected"'
if option_value in selected_choices else '') if option_value in selected_choices else '')
other_html += self.transform_option_html_attrs(option_label) other_html += self.transform_option_html_attrs(option_label)
@ -254,7 +254,7 @@ class SelectWidget(widgets.Widget):
option_label = self.transform_option_label(option_label) option_label = self.transform_option_label(option_label)
return u'<option value="%s"%s>%s</option>' % ( return '<option value="%s"%s>%s</option>' % (
html.escape(option_value), other_html, option_label) html.escape(option_value), other_html, option_label)
def render_options(self, selected_choices): def render_options(self, selected_choices):
@ -424,7 +424,7 @@ class ThemableCheckboxInput(widgets.CheckboxInput):
label_for = attrs['id'] label_for = attrs['id']
return html.format_html( return html.format_html(
u'<div class="themable-checkbox">{}<label for="{}"></label></div>', '<div class="themable-checkbox">{}<label for="{}"></label></div>',
super().render(name, value, attrs), super().render(name, value, attrs),
label_for label_for
) )
@ -538,8 +538,8 @@ class ThemableCheckboxChoiceInput(ChoiceInput):
label_for = '' label_for = ''
attrs = dict(self.attrs, **attrs) if attrs else self.attrs attrs = dict(self.attrs, **attrs) if attrs else self.attrs
return html.format_html( return html.format_html(
u'<div class="themable-checkbox">{}<label{}>' + '<div class="themable-checkbox">{}<label{}>' +
u'<span>{}</span></label></div>', '<span>{}</span></label></div>',
self.tag(attrs), label_for, self.choice_label self.tag(attrs), label_for, self.choice_label
) )

View File

@ -758,7 +758,7 @@ class BatchAction(Action):
datum_display = table.get_object_display(datum) or datum_id datum_display = table.get_object_display(datum) or datum_id
if not table._filter_action(self, request, datum): if not table._filter_action(self, request, datum):
action_not_allowed.append(datum_display) action_not_allowed.append(datum_display)
LOG.warning(u'Permission denied to %(name)s: "%(dis)s"', { LOG.warning('Permission denied to %(name)s: "%(dis)s"', {
'name': self._get_action_name(past=True).lower(), 'name': self._get_action_name(past=True).lower(),
'dis': datum_display 'dis': datum_display
}) })
@ -769,7 +769,7 @@ class BatchAction(Action):
self.update(request, datum) self.update(request, datum)
action_success.append(datum_display) action_success.append(datum_display)
self.success_ids.append(datum_id) self.success_ids.append(datum_id)
LOG.info(u'%(action)s: "%(datum_display)s"', LOG.info('%(action)s: "%(datum_display)s"',
{'action': self._get_action_name(past=True), {'action': self._get_action_name(past=True),
'datum_display': datum_display}) 'datum_display': datum_display})
except Exception as ex: except Exception as ex:

View File

@ -28,8 +28,8 @@ class SellPuppy(tables.DeleteAction):
def action_present(count): def action_present(count):
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Sell Puppy", "Sell Puppy",
u"Sell Puppies", "Sell Puppies",
count count
) )
@ -37,8 +37,8 @@ class SellPuppy(tables.DeleteAction):
def action_past(count): def action_past(count):
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Sold Puppy", "Sold Puppy",
u"Sold Puppies", "Sold Puppies",
count count
) )

View File

@ -29,8 +29,8 @@ from horizon.test import helpers as test
class OperationLogMiddlewareTest(django_test.TestCase): class OperationLogMiddlewareTest(django_test.TestCase):
http_host = u'test_host' http_host = 'test_host'
http_referer = u'/dashboard/test_http_referer' http_referer = '/dashboard/test_http_referer'
def setUp(self): def setUp(self):
super().setUp() super().setUp()
@ -48,10 +48,10 @@ class OperationLogMiddlewareTest(django_test.TestCase):
request.META['HTTP_HOST'] = self.http_host request.META['HTTP_HOST'] = self.http_host
request.META['HTTP_REFERER'] = self.http_referer request.META['HTTP_REFERER'] = self.http_referer
request.POST = { request.POST = {
"username": u"admin", "username": "admin",
"password": u"pass" "password": "pass"
} }
request.user.username = u'test_user_name' request.user.username = 'test_user_name'
response = HttpResponseRedirect(url) response = HttpResponseRedirect(url)
response.client = self.client response.client = self.client
@ -63,7 +63,7 @@ class OperationLogMiddlewareTest(django_test.TestCase):
request = self.factory.get(url) request = self.factory.get(url)
request.META['HTTP_HOST'] = self.http_host request.META['HTTP_HOST'] = self.http_host
request.META['HTTP_REFERER'] = self.http_referer request.META['HTTP_REFERER'] = self.http_referer
request.user.username = u'test_user_name' request.user.username = 'test_user_name'
response = HttpResponseRedirect(url) response = HttpResponseRedirect(url)
response.client = self.client response.client = self.client

View File

@ -46,15 +46,15 @@ class FakeObject(object):
self.extra = "extra" self.extra = "extra"
def __str__(self): def __str__(self):
return u"%s: %s" % (self.__class__.__name__, self.name) return "%s: %s" % (self.__class__.__name__, self.name)
TEST_DATA = ( TEST_DATA = (
FakeObject('1', 'object_1', 'value_1', 'up', 'optional_1', 'excluded_1'), FakeObject('1', 'object_1', 'value_1', 'up', 'optional_1', 'excluded_1'),
FakeObject('2', 'object_2', '<strong>evil</strong>', 'down', 'optional_2'), FakeObject('2', 'object_2', '<strong>evil</strong>', 'down', 'optional_2'),
FakeObject('3', 'object_3', 'value_3', 'up'), FakeObject('3', 'object_3', 'value_3', 'up'),
FakeObject('4', u'öbject_4', u'välue_1', u'üp', u'öptional_1', FakeObject('4', 'öbject_4', 'välue_1', 'üp', 'öptional_1',
u'exclüded_1'), 'exclüded_1'),
) )
TEST_DATA_2 = ( TEST_DATA_2 = (
@ -158,8 +158,8 @@ class MyBatchAction(tables.BatchAction):
def action_present(count): def action_present(count):
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Batch Item", "Batch Item",
u"Batch Items", "Batch Items",
count count
) )
@ -167,8 +167,8 @@ class MyBatchAction(tables.BatchAction):
def action_past(count): def action_past(count):
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Batched Item", "Batched Item",
u"Batched Items", "Batched Items",
count count
) )
@ -180,12 +180,12 @@ class MyBatchActionWithHelpText(MyBatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
# No translation # No translation
return u"BatchHelp Item" return "BatchHelp Item"
@staticmethod @staticmethod
def action_past(count): def action_past(count):
# No translation # No translation
return u"BatchedHelp Item" return "BatchedHelp Item"
class MyToggleAction(tables.BatchAction): class MyToggleAction(tables.BatchAction):
@ -195,15 +195,15 @@ class MyToggleAction(tables.BatchAction):
if self.current_present_action: if self.current_present_action:
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Up Item", "Up Item",
u"Up Items", "Up Items",
count count
) )
else: else:
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Down Item", "Down Item",
u"Down Items", "Down Items",
count count
) )
@ -211,15 +211,15 @@ class MyToggleAction(tables.BatchAction):
if self.current_past_action: if self.current_past_action:
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Upped Item", "Upped Item",
u"Upped Items", "Upped Items",
count count
) )
else: else:
# Translators: test code, don't really have to translate # Translators: test code, don't really have to translate
return ungettext_lazy( return ungettext_lazy(
u"Downed Item", "Downed Item",
u"Downed Items", "Downed Items",
count count
) )
@ -419,7 +419,7 @@ class DataTableTests(test.TestCase):
self.assertTrue(self.table._meta.actions_column) self.assertTrue(self.table._meta.actions_column)
self.assertTrue(self.table._meta.multi_select) self.assertTrue(self.table._meta.multi_select)
# Test for verbose_name # Test for verbose_name
self.assertEqual(u"My Table", str(self.table)) self.assertEqual("My Table", str(self.table))
# Column ordering and exclusion. # Column ordering and exclusion.
# This should include auto-columns for multi_select and actions, # This should include auto-columns for multi_select and actions,
# but should not contain the excluded column. # but should not contain the excluded column.
@ -666,7 +666,7 @@ class DataTableTests(test.TestCase):
row = self.table.get_rows()[0] row = self.table.get_rows()[0]
self.assertEqual(35, len(row.cells['status'].data)) self.assertEqual(35, len(row.cells['status'].data))
self.assertEqual(u'A Status that is longer than 35 ch…', self.assertEqual('A Status that is longer than 35 ch…',
row.cells['status'].data) row.cells['status'].data)
def test_table_rendering(self): def test_table_rendering(self):
@ -830,7 +830,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1', ['FakeObject: object_1',
'FakeObject: object_2', 'FakeObject: object_2',
'FakeObject: object_3', 'FakeObject: object_3',
u'FakeObject: öbject_4'], 'FakeObject: öbject_4'],
transform=str) transform=str)
# with unknown value it should return empty list # with unknown value it should return empty list
@ -913,7 +913,7 @@ class DataTableTests(test.TestCase):
handled = self.table.maybe_handle() handled = self.table.maybe_handle()
self.assertEqual(302, handled.status_code) self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"]) self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Downed Item: object_1", self.assertEqual("Downed Item: object_1",
list(req._messages)[0].message) list(req._messages)[0].message)
# Toggle from status 'down' to 'up' # Toggle from status 'down' to 'up'
@ -933,7 +933,7 @@ class DataTableTests(test.TestCase):
handled = self.table.maybe_handle() handled = self.table.maybe_handle()
self.assertEqual(302, handled.status_code) self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"]) self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Upped Item: object_2", self.assertEqual("Upped Item: object_2",
list(req._messages)[0].message) list(req._messages)[0].message)
# there are underscore in object-id. # there are underscore in object-id.
@ -1014,7 +1014,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1', ['FakeObject: object_1',
'FakeObject: object_2', 'FakeObject: object_2',
'FakeObject: object_3', 'FakeObject: object_3',
u'FakeObject: öbject_4'], 'FakeObject: öbject_4'],
transform=str) transform=str)
# Updating and preemptive actions # Updating and preemptive actions
@ -1074,7 +1074,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1', ['FakeObject: object_1',
'FakeObject: object_2', 'FakeObject: object_2',
'FakeObject: object_3', 'FakeObject: object_3',
u'FakeObject: öbject_4'], 'FakeObject: öbject_4'],
transform=str) transform=str)
def test_column_uniqueness(self): def test_column_uniqueness(self):
@ -1166,8 +1166,7 @@ class DataTableTests(test.TestCase):
self.assertEqual(302, handled.status_code) self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"]) self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Downed Item: 1", self.assertEqual("Downed Item: 1", list(req._messages)[0].message)
list(req._messages)[0].message)
mock_get_object_display.assert_called_once_with( mock_get_object_display.assert_called_once_with(
test.IsA(FakeObject)) test.IsA(FakeObject))
@ -1368,7 +1367,7 @@ class DataTableViewTests(test.TestCase):
['FakeObject: object_1', ['FakeObject: object_1',
'FakeObject: object_2', 'FakeObject: object_2',
'FakeObject: object_3', 'FakeObject: object_3',
u'FakeObject: öbject_4'], 'FakeObject: öbject_4'],
transform=str) transform=str)
self.assertEqual(req.session.get(self.fil_value_param), 'up') self.assertEqual(req.session.get(self.fil_value_param), 'up')
self.assertEqual(req.session.get(self.fil_field_param), 'status') self.assertEqual(req.session.get(self.fil_field_param), 'status')

View File

@ -296,7 +296,7 @@ class TabTests(test.TestCase):
['FakeObject: object_1', ['FakeObject: object_1',
'FakeObject: object_2', 'FakeObject: object_2',
'FakeObject: object_3', 'FakeObject: object_3',
u'FakeObject: öbject_4'], 'FakeObject: öbject_4'],
transform=str) transform=str)
context = tab.get_context_data(self.request) context = tab.get_context_data(self.request)
# Make sure our table is loaded into the context correctly # Make sure our table is loaded into the context correctly

View File

@ -63,7 +63,7 @@ class TemplateTagTests(test.TestCase):
size_str = ('5|diskgbformat', '10|diskgbformat', size_str = ('5|diskgbformat', '10|diskgbformat',
'5555|mb_float_format', '80|mb_float_format', '5555|mb_float_format', '80|mb_float_format',
'.5|mbformat', '0.005|mbformat', '0.0005|mbformat') '.5|mbformat', '0.005|mbformat', '0.0005|mbformat')
expected = u' 5GB 10GB 5.4GB 80MB 512KB 5KB 524Bytes ' expected = ' 5GB 10GB 5.4GB 80MB 512KB 5KB 524Bytes '
text = '' text = ''
for size_filter in size_str: for size_filter in size_str:
@ -76,7 +76,7 @@ class TemplateTagTests(test.TestCase):
def test_size_format_filters_with_string(self): def test_size_format_filters_with_string(self):
size_str = ('"test"|diskgbformat', '"limit"|mb_float_format', size_str = ('"test"|diskgbformat', '"limit"|mb_float_format',
'"no limit"|mbformat') '"no limit"|mbformat')
expected = u' test limit no limit ' expected = ' test limit no limit '
text = '' text = ''
for size_filter in size_str: for size_filter in size_str:
@ -94,7 +94,7 @@ class TemplateTagTests(test.TestCase):
text = ('{{ test.val1|truncate:1 }}#{{ test.val2|truncate:4 }}#' text = ('{{ test.val1|truncate:1 }}#{{ test.val2|truncate:4 }}#'
'{{ test.val3|truncate:10 }}') '{{ test.val3|truncate:10 }}')
expected = u' h#h...#four' expected = ' h#h...#four'
rendered_str = self.render_template(tag_require='truncate_filter', rendered_str = self.render_template(tag_require='truncate_filter',
template_text=text, template_text=text,
context={'test': ctx_string}) context={'test': ctx_string})
@ -108,7 +108,7 @@ class TemplateTagTests(test.TestCase):
text = ('{{ test.val1|quota:"TB" }}#{{ test.val2|quota }}#' text = ('{{ test.val1|quota:"TB" }}#{{ test.val2|quota }}#'
'{{ test.val3|quota }}') '{{ test.val3|quota }}')
expected = u' 100 TB Available#1000 Available#(No Limit)' expected = ' 100 TB Available#1000 Available#(No Limit)'
rendered_str = self.render_template(tag_require='horizon', rendered_str = self.render_template(tag_require='horizon',
template_text=text, template_text=text,

View File

@ -18,10 +18,10 @@ from horizon.test import helpers as test
class HandleTests(test.TestCase): class HandleTests(test.TestCase):
def test_handle_translated(self): def test_handle_translated(self):
translated_unicode = u'\u30b3\u30f3\u30c6\u30ca\u30fc\u304c' \ translated_unicode = '\u30b3\u30f3\u30c6\u30ca\u30fc\u304c' \
u'\u7a7a\u3067\u306f\u306a\u3044\u305f' \ '\u7a7a\u3067\u306f\u306a\u3044\u305f' \
u'\u3081\u3001\u524a\u9664\u3067\u304d' \ '\u3081\u3001\u524a\u9664\u3067\u304d' \
u'\u307e\u305b\u3093\u3002' '\u307e\u305b\u3093\u3002'
# Japanese translation of: # Japanese translation of:
# 'Because the container is not empty, it can not be deleted.' # 'Because the container is not empty, it can not be deleted.'
@ -45,8 +45,8 @@ class HandleTests(test.TestCase):
# tests that if a message is passed to handle that it is treated # tests that if a message is passed to handle that it is treated
# like a recoverable exception # like a recoverable exception
message = u"Couldn't make the thing" message = "Couldn't make the thing"
exc_msg = u"Exception string" exc_msg = "Exception string"
req = self.request req = self.request
req.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' req.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
@ -64,7 +64,7 @@ class HandleTests(test.TestCase):
self.assertIn(exc_msg, req.horizon['async_messages'][0][1]) self.assertIn(exc_msg, req.horizon['async_messages'][0][1])
def test_handle_exception_with_empty_details(self): def test_handle_exception_with_empty_details(self):
message = u"Couldn't make the thing" message = "Couldn't make the thing"
details = "" details = ""
expected = ['error', message, ''] expected = ['error', message, '']
req = self.request req = self.request
@ -78,8 +78,8 @@ class HandleTests(test.TestCase):
self.assertCountEqual(req.horizon['async_messages'], [expected]) self.assertCountEqual(req.horizon['async_messages'], [expected])
def test_handle_exception_with_details(self): def test_handle_exception_with_details(self):
message = u"Couldn't make the thing" message = "Couldn't make the thing"
exc_msg = u"Exception string" exc_msg = "Exception string"
details = "custom detail message" details = "custom detail message"
expected = ['error', message + exceptions.SEPERATOR + details, ''] expected = ['error', message + exceptions.SEPERATOR + details, '']
req = self.request req = self.request

View File

@ -38,8 +38,8 @@ class ExtractAngularTestCase(test.TestCase):
messages = list(extract_angular(buf, default_keys, [], {})) messages = list(extract_angular(buf, default_keys, [], {}))
self.assertEqual( self.assertEqual(
[ [
(1, u'gettext', 'hello world!', []), (1, 'gettext', 'hello world!', []),
(2, u'gettext', 'hello world!', []) (2, 'gettext', 'hello world!', [])
], ],
messages) messages)
@ -150,19 +150,19 @@ class ExtractAngularTestCase(test.TestCase):
messages = list(extract_angular(buf, default_keys, [], {})) messages = list(extract_angular(buf, default_keys, [], {}))
self.assertEqual( self.assertEqual(
[ [
(2, u'gettext', 'hello world1', []), (2, 'gettext', 'hello world1', []),
(3, u'gettext', 'hello world2', []), (3, 'gettext', 'hello world2', []),
(4, u'gettext', 'hello world3', []), (4, 'gettext', 'hello world3', []),
(4, u'gettext', 'hello world4', []), (4, 'gettext', 'hello world4', []),
(8, u'gettext', '"it\\\'s awesome"', []), (8, 'gettext', '"it\\\'s awesome"', []),
(9, u'gettext', 'oh \\"hello\\" there', []), (9, 'gettext', 'oh \\"hello\\" there', []),
(10, u'gettext', u'hello colon1', []), (10, 'gettext', 'hello colon1', []),
(11, u'gettext', u'hello colon2', []), (11, 'gettext', 'hello colon2', []),
(12, u'gettext', u'hello colon3', []), (12, 'gettext', 'hello colon3', []),
(13, u'gettext', u'hello colon4', []), (13, 'gettext', 'hello colon4', []),
(13, u'gettext', u'hello colon5', []), (13, 'gettext', 'hello colon5', []),
(17, u'gettext', u'"it\\\'s awesome"', []), (17, 'gettext', '"it\\\'s awesome"', []),
(18, u'gettext', u'oh \\"hello\\" there', []), (18, 'gettext', 'oh \\"hello\\" there', []),
], ],
messages) messages)
@ -196,8 +196,8 @@ class ExtractAngularTestCase(test.TestCase):
messages = list(extract_angular(buf, [], [], {})) messages = list(extract_angular(buf, [], [], {}))
self.assertEqual( self.assertEqual(
[ [
(2, u'gettext', 'To <a href="link">link</a> here', []), (2, 'gettext', 'To <a href="link">link</a> here', []),
(3, u'gettext', 'To <!-- a comment!! --> here', []), (3, 'gettext', 'To <!-- a comment!! --> here', []),
(4, u'gettext', u'To trademark® &#62; &#x3E; here', []), (4, 'gettext', 'To trademark® &#62; &#x3E; here', []),
], ],
messages) messages)

View File

@ -29,25 +29,25 @@ class FiltersTests(test.TestCase):
def test_parse_isotime_filter(self): def test_parse_isotime_filter(self):
c = django.template.Context({'time': ''}) c = django.template.Context({'time': ''})
t = django.template.Template('{{ time|parse_isotime }}') t = django.template.Template('{{ time|parse_isotime }}')
output = u"" output = ""
self.assertEqual(output, t.render(c)) self.assertEqual(output, t.render(c))
c = django.template.Context({'time': 'error'}) c = django.template.Context({'time': 'error'})
t = django.template.Template('{{ time|parse_isotime }}') t = django.template.Template('{{ time|parse_isotime }}')
output = u"" output = ""
self.assertEqual(output, t.render(c)) self.assertEqual(output, t.render(c))
c = django.template.Context({'time': 'error'}) c = django.template.Context({'time': 'error'})
t = django.template.Template('{{ time|parse_isotime:"test" }}') t = django.template.Template('{{ time|parse_isotime:"test" }}')
output = u"test" output = "test"
self.assertEqual(output, t.render(c)) self.assertEqual(output, t.render(c))
c = django.template.Context({'time': '2007-03-04T21:08:12'}) c = django.template.Context({'time': '2007-03-04T21:08:12'})
t = django.template.Template('{{ time|parse_isotime:"test" }}') t = django.template.Template('{{ time|parse_isotime:"test" }}')
output = u"March 4, 2007, 9:08 p.m." output = "March 4, 2007, 9:08 p.m."
self.assertEqual(output, t.render(c)) self.assertEqual(output, t.render(c))
@ -58,7 +58,7 @@ class FiltersTests(test.TestCase):
class TimeSinceNeverFilterTests(test.TestCase): class TimeSinceNeverFilterTests(test.TestCase):
default = u"Never" default = "Never"
def test_timesince_or_never_returns_default_for_empty_string(self): def test_timesince_or_never_returns_default_for_empty_string(self):
c = django.template.Context({'time': ''}) c = django.template.Context({'time': ''})

View File

@ -30,8 +30,8 @@ filter_regex = re.compile(
# to HTML_ENTITIES as necessary. # to HTML_ENTITIES as necessary.
HTML_ENTITY_PASSTHROUGH = {'amp', 'gt', 'lt'} HTML_ENTITY_PASSTHROUGH = {'amp', 'gt', 'lt'}
HTML_ENTITY_DECODED = { HTML_ENTITY_DECODED = {
'reg': u'®', 'reg': '®',
'times': u'×' 'times': '×'
} }
@ -92,7 +92,7 @@ class AngularGettextHTMLParser(parser.HTMLParser):
for match in filter_regex.findall(attr[1]): for match in filter_regex.findall(attr[1]):
if match: if match:
self.strings.append( self.strings.append(
(self.line, u'gettext', match[1][1:-1], []) (self.line, 'gettext', match[1][1:-1], [])
) )
def handle_data(self, data): def handle_data(self, data):
@ -101,7 +101,7 @@ class AngularGettextHTMLParser(parser.HTMLParser):
else: else:
for match in filter_regex.findall(data): for match in filter_regex.findall(data):
self.strings.append( self.strings.append(
(self.line, u'gettext', match[1][1:-1], []) (self.line, 'gettext', match[1][1:-1], [])
) )
def handle_entityref(self, name): def handle_entityref(self, name):
@ -130,10 +130,10 @@ class AngularGettextHTMLParser(parser.HTMLParser):
self.data.strip(), self.data.strip(),
self.plural_form self.plural_form
) )
func_name = u'ngettext' func_name = 'ngettext'
else: else:
messages = self.data.strip() messages = self.data.strip()
func_name = u'gettext' func_name = 'gettext'
self.strings.append( self.strings.append(
(self.line, func_name, messages, self.comments) (self.line, func_name, messages, self.comments)
) )

View File

@ -51,7 +51,7 @@ DEFAULT_QUOTA_NAME = 'default'
CONSUMER_CHOICES = ( CONSUMER_CHOICES = (
('back-end', _('back-end')), ('back-end', _('back-end')),
('front-end', _('front-end')), ('front-end', _('front-end')),
('both', pgettext_lazy('Both of front-end and back-end', u'both')), ('both', pgettext_lazy('Both of front-end and back-end', 'both')),
) )
VERSIONS = base.APIVersionManager("volume", preferred_version='3') VERSIONS = base.APIVersionManager("volume", preferred_version='3')

View File

@ -252,7 +252,7 @@ class SecurityGroupRule(NeutronAPIDictWrapper):
def _get_secgroup_name(self, sg_id, sg_dict): def _get_secgroup_name(self, sg_id, sg_dict):
if not sg_id: if not sg_id:
return u'' return ''
if sg_dict is None: if sg_dict is None:
sg_dict = {} sg_dict = {}
@ -1765,10 +1765,10 @@ def _server_get_addresses(request, server, ports, floating_ips, network_names):
error_message = _('Unable to parse IP address %s.') % ip error_message = _('Unable to parse IP address %s.') % ip
messages.error(request, error_message) messages.error(request, error_message)
raise raise
return {u'OS-EXT-IPS-MAC:mac_addr': mac, return {'OS-EXT-IPS-MAC:mac_addr': mac,
u'version': version, 'version': version,
u'addr': ip, 'addr': ip,
u'OS-EXT-IPS:type': type} 'OS-EXT-IPS:type': type}
addresses = collections.defaultdict(list) addresses = collections.defaultdict(list)
instance_ports = ports.get(server.id, []) instance_ports = ports.get(server.id, [])
@ -1780,7 +1780,7 @@ def _server_get_addresses(request, server, ports, floating_ips, network_names):
addresses[network_name].append( addresses[network_name].append(
_format_address(port.mac_address, _format_address(port.mac_address,
fixed_ip['ip_address'], fixed_ip['ip_address'],
u'fixed')) 'fixed'))
else: else:
addresses[network_name] = [] addresses[network_name] = []
port_fips = floating_ips.get(port.id, []) port_fips = floating_ips.get(port.id, [])
@ -1788,7 +1788,7 @@ def _server_get_addresses(request, server, ports, floating_ips, network_names):
addresses[network_name].append( addresses[network_name].append(
_format_address(port.mac_address, _format_address(port.mac_address,
fip.floating_ip_address, fip.floating_ip_address,
u'floating')) 'floating'))
return dict(addresses) return dict(addresses)

View File

@ -116,7 +116,7 @@ class Container(generic.View):
return rest_utils.JSONResponse(str(e), 409) return rest_utils.JSONResponse(str(e), 409)
return rest_utils.CreatedResponse( return rest_utils.CreatedResponse(
u'/api/swift/containers/%s' % container, '/api/swift/containers/%s' % container,
) )
@rest_utils.ajax() @rest_utils.ajax()
@ -219,7 +219,7 @@ class Object(generic.View):
) )
return rest_utils.CreatedResponse( return rest_utils.CreatedResponse(
u'/api/swift/containers/%s/object/%s' % (container, result.name) '/api/swift/containers/%s/object/%s' % (container, result.name)
) )
@rest_utils.ajax() @rest_utils.ajax()
@ -293,6 +293,6 @@ class ObjectCopy(generic.View):
except exceptions.AlreadyExists as e: except exceptions.AlreadyExists as e:
return rest_utils.JSONResponse(str(e), 409) return rest_utils.JSONResponse(str(e), 409)
return rest_utils.CreatedResponse( return rest_utils.CreatedResponse(
u'/api/swift/containers/%s/object/%s' % (dest_container, '/api/swift/containers/%s/object/%s' % (dest_container,
result.name) result.name)
) )

View File

@ -26,16 +26,16 @@ class DeleteAggregateAction(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Host Aggregate", "Delete Host Aggregate",
u"Delete Host Aggregates", "Delete Host Aggregates",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Host Aggregate", "Deleted Host Aggregate",
u"Deleted Host Aggregates", "Deleted Host Aggregates",
count count
) )

View File

@ -104,7 +104,7 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
workflow_data['name'] = '' workflow_data['name'] = ''
workflow_data['availability_zone'] = '' workflow_data['availability_zone'] = ''
self._test_generic_create_aggregate(workflow_data, aggregate, (), 1, self._test_generic_create_aggregate(workflow_data, aggregate, (), 1,
u'This field is required') 'This field is required')
def test_create_aggregate_fails_missing_fields_existing_aggregates(self): def test_create_aggregate_fails_missing_fields_existing_aggregates(self):
aggregate = self.aggregates.first() aggregate = self.aggregates.first()
@ -115,14 +115,14 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
self._test_generic_create_aggregate(workflow_data, aggregate, self._test_generic_create_aggregate(workflow_data, aggregate,
existing_aggregates, 1, existing_aggregates, 1,
u'This field is required') 'This field is required')
def test_create_aggregate_fails_duplicated_name(self): def test_create_aggregate_fails_duplicated_name(self):
aggregate = self.aggregates.first() aggregate = self.aggregates.first()
existing_aggregates = self.aggregates.list() existing_aggregates = self.aggregates.list()
workflow_data = self._get_create_workflow_data(aggregate) workflow_data = self._get_create_workflow_data(aggregate)
expected_error_message = html \ expected_error_message = html \
.escape(u'The name "%s" is already used by another host aggregate.' .escape('The name "%s" is already used by another host aggregate.'
% aggregate.name) % aggregate.name)
self._test_generic_create_aggregate(workflow_data, aggregate, self._test_generic_create_aggregate(workflow_data, aggregate,
@ -254,7 +254,7 @@ class AggregatesViewTests(test.BaseAdminViewTests):
'availability_zone': aggregate.availability_zone} 'availability_zone': aggregate.availability_zone}
self._test_generic_update_aggregate(form_data, aggregate, 1, self._test_generic_update_aggregate(form_data, aggregate, 1,
u'This field is required') 'This field is required')
def test_update_aggregate_fails_missing_az_field(self): def test_update_aggregate_fails_missing_az_field(self):
aggregate = self.aggregates.first() aggregate = self.aggregates.first()
@ -264,7 +264,7 @@ class AggregatesViewTests(test.BaseAdminViewTests):
self._test_generic_update_aggregate( self._test_generic_update_aggregate(
form_data, aggregate, 1, form_data, aggregate, 1,
u'The new availability zone can&#39;t be empty') 'The new availability zone can&#39;t be empty')
class ManageHostsTests(test.BaseAdminViewTests): class ManageHostsTests(test.BaseAdminViewTests):

View File

@ -34,16 +34,16 @@ class DeleteFlavor(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Flavor", "Delete Flavor",
u"Delete Flavors", "Delete Flavors",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Flavor", "Deleted Flavor",
u"Deleted Flavors", "Deleted Flavors",
count count
) )

View File

@ -26,16 +26,16 @@ class GroupTypeSpecDelete(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Spec", "Delete Spec",
u"Delete Specs", "Delete Specs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Spec", "Delete Spec",
u"Delete Specs", "Delete Specs",
count count
) )

View File

@ -64,8 +64,8 @@ class GroupTypeSpecTests(test.BaseAdminViewTests):
index_url = reverse( index_url = reverse(
'horizon:admin:group_types:index') 'horizon:admin:group_types:index')
data = {'key': u'k1', data = {'key': 'k1',
'value': u'v1'} 'value': 'v1'}
self.mock_group_type_spec_set.return_value = None self.mock_group_type_spec_set.return_value = None
resp = self.client.post(create_url, data) resp = self.client.post(create_url, data)
@ -101,7 +101,7 @@ class GroupTypeSpecTests(test.BaseAdminViewTests):
args=[group_type.id, key]) args=[group_type.id, key])
index_url = reverse('horizon:admin:group_types:index') index_url = reverse('horizon:admin:group_types:index')
data = {'value': u'v1'} data = {'value': 'v1'}
specs = {key: data['value']} specs = {key: data['value']}
self.mock_group_type_spec_list.return_value = specs self.mock_group_type_spec_list.return_value = specs

View File

@ -63,16 +63,16 @@ class DeleteGroupType(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Group Type", "Delete Group Type",
u"Delete Group Types", "Delete Group Types",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Group Type", "Deleted Group Type",
u"Deleted Group Types", "Deleted Group Types",
count count
) )
policy_rules = (("volume", "group:group_types_manage"),) policy_rules = (("volume", "group:group_types_manage"),)

View File

@ -55,16 +55,16 @@ class EnableService(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Enable Service", "Enable Service",
u"Enable Services", "Enable Services",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Enabled Service", "Enabled Service",
u"Enabled Services", "Enabled Services",
count count
) )
@ -103,13 +103,11 @@ class ComputeHostTable(tables.DataTable):
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("enabled", pgettext_lazy("Current status of a Hypervisor", ("enabled", pgettext_lazy("Current status of a Hypervisor",
u"Enabled")), "Enabled")),
("disabled", pgettext_lazy("Current status of a Hypervisor", ("disabled", pgettext_lazy("Current status of a Hypervisor",
u"Disabled")), "Disabled")),
("up", pgettext_lazy("Current state of a Hypervisor", ("up", pgettext_lazy("Current state of a Hypervisor", "Up")),
u"Up")), ("down", pgettext_lazy("Current state of a Hypervisor", "Down")),
("down", pgettext_lazy("Current state of a Hypervisor",
u"Down")),
) )
host = tables.WrappingColumn('host', verbose_name=_('Host')) host = tables.WrappingColumn('host', verbose_name=_('Host'))

View File

@ -111,7 +111,7 @@ class NovaServicesTable(tables.DataTable):
updated_at = tables.Column('updated_at', updated_at = tables.Column('updated_at',
verbose_name=pgettext_lazy( verbose_name=pgettext_lazy(
'Time since the last update', 'Time since the last update',
u'Last Updated'), 'Last Updated'),
filters=(utils_filters.parse_isotime, filters=(utils_filters.parse_isotime,
filters.timesince)) filters.timesince))
@ -135,7 +135,7 @@ class CinderServicesTable(tables.DataTable):
updated_at = tables.Column('updated_at', updated_at = tables.Column('updated_at',
verbose_name=pgettext_lazy( verbose_name=pgettext_lazy(
'Time since the last update', 'Time since the last update',
u'Last Updated'), 'Last Updated'),
filters=(utils_filters.parse_isotime, filters=(utils_filters.parse_isotime,
filters.timesince)) filters.timesince))
@ -209,7 +209,7 @@ class NetworkAgentsTable(tables.DataTable):
heartbeat_timestamp = tables.Column('heartbeat_timestamp', heartbeat_timestamp = tables.Column('heartbeat_timestamp',
verbose_name=pgettext_lazy( verbose_name=pgettext_lazy(
'Time since the last update', 'Time since the last update',
u'Last Updated'), 'Last Updated'),
filters=(utils_filters.parse_isotime, filters=(utils_filters.parse_isotime,
filters.timesince)) filters.timesince))

View File

@ -56,16 +56,16 @@ class MigrateInstance(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Migrate Instance", "Migrate Instance",
u"Migrate Instances", "Migrate Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled migration (pending confirmation) of Instance", "Scheduled migration (pending confirmation) of Instance",
u"Scheduled migration (pending confirmation) of Instances", "Scheduled migration (pending confirmation) of Instances",
count count
) )

View File

@ -44,16 +44,16 @@ class DeleteNamespace(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Namespace", "Delete Namespace",
u"Delete Namespaces", "Delete Namespaces",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Namespace", "Deleted Namespace",
u"Deleted Namespaces", "Deleted Namespaces",
count count
) )

View File

@ -32,16 +32,16 @@ class DeleteDHCPAgent(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete DHCP Agent", "Delete DHCP Agent",
u"Delete DHCP Agents", "Delete DHCP Agents",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted DHCP Agent", "Deleted DHCP Agent",
u"Deleted DHCP Agents", "Deleted DHCP Agents",
count count
) )

View File

@ -69,8 +69,8 @@ class CreateSubnet(project_tables.CreateSubnet):
DISPLAY_CHOICES = ( DISPLAY_CHOICES = (
("up", pgettext_lazy("Admin state of a Network", u"UP")), ("up", pgettext_lazy("Admin state of a Network", "UP")),
("down", pgettext_lazy("Admin state of a Network", u"DOWN")), ("down", pgettext_lazy("Admin state of a Network", "DOWN")),
) )

View File

@ -78,7 +78,7 @@ class UsageViewTests(test.BaseAdminViewTests):
self.assertEqual(nova_stu_enabled, self.assertEqual(nova_stu_enabled,
res.context['simple_tenant_usage_enabled']) res.context['simple_tenant_usage_enabled'])
usage_table = encoding.smart_str(u''' usage_table = encoding.smart_str('''
<tr class="" data-object-id="1" id="global_usage__row__1"> <tr class="" data-object-id="1" id="global_usage__row__1">
<td class="sortable normal_column">test_tenant</td> <td class="sortable normal_column">test_tenant</td>
<td class="sortable normal_column">%s</td> <td class="sortable normal_column">%s</td>
@ -97,7 +97,7 @@ class UsageViewTests(test.BaseAdminViewTests):
) )
# test for deleted project # test for deleted project
usage_table_deleted = encoding.smart_str(u''' usage_table_deleted = encoding.smart_str('''
<tr class="" data-object-id="3" id="global_usage__row__3"> <tr class="" data-object-id="3" id="global_usage__row__3">
<td class="sortable normal_column">3 (Deleted)</td> <td class="sortable normal_column">3 (Deleted)</td>
<td class="sortable normal_column">%s</td> <td class="sortable normal_column">%s</td>
@ -168,7 +168,7 @@ class UsageViewTests(test.BaseAdminViewTests):
if nova_stu_enabled: if nova_stu_enabled:
for obj in usage_obj: for obj in usage_obj:
row = u'"{0}","{1}","{2}","{3}","{4:.2f}"\r\n'.format( row = '"{0}","{1}","{2}","{3}","{4:.2f}"\r\n'.format(
obj.project_name, obj.project_name,
obj.vcpus, obj.vcpus,
obj.memory_mb, obj.memory_mb,

View File

@ -36,16 +36,16 @@ class DeleteRBACPolicy(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete RBAC Policy", "Delete RBAC Policy",
u"Delete RBAC Policies", "Delete RBAC Policies",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted RBAC Policy", "Deleted RBAC Policy",
u"Deleted RBAC Policies", "Deleted RBAC Policies",
count count
) )

View File

@ -24,16 +24,16 @@ class ExtraSpecDelete(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Extra Spec", "Delete Extra Spec",
u"Delete Extra Specs", "Delete Extra Specs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Extra Spec", "Deleted Extra Spec",
u"Deleted Extra Specs", "Deleted Extra Specs",
count count
) )

View File

@ -65,8 +65,8 @@ class VolTypeExtrasTests(test.BaseAdminViewTests):
'horizon:admin:volume_types:extras:index', 'horizon:admin:volume_types:extras:index',
args=[vol_type.id]) args=[vol_type.id])
data = {'key': u'k1', data = {'key': 'k1',
'value': u'v1'} 'value': 'v1'}
self.mock_volume_type_extra_set.return_value = None self.mock_volume_type_extra_set.return_value = None
resp = self.client.post(create_url, data) resp = self.client.post(create_url, data)
@ -103,7 +103,7 @@ class VolTypeExtrasTests(test.BaseAdminViewTests):
index_url = reverse('horizon:admin:volume_types:extras:index', index_url = reverse('horizon:admin:volume_types:extras:index',
args=[vol_type.id]) args=[vol_type.id])
data = {'value': u'v1'} data = {'value': 'v1'}
extras = {key: data['value']} extras = {key: data['value']}
self.mock_volume_type_extra_get.return_value = extras self.mock_volume_type_extra_get.return_value = extras

View File

@ -112,7 +112,7 @@ class CreateVolumeTypeEncryption(forms.SelfHandlingForm):
def handle(self, request, data): def handle(self, request, data):
try: try:
# Set Cipher to None if empty # Set Cipher to None if empty
if data['cipher'] == u'': if data['cipher'] == '':
data['cipher'] = None data['cipher'] = None
volume_type_id = data.pop('volume_type_id') volume_type_id = data.pop('volume_type_id')
@ -138,7 +138,7 @@ class UpdateVolumeTypeEncryption(CreateVolumeTypeEncryption):
def handle(self, request, data): def handle(self, request, data):
try: try:
# Set Cipher to None if empty # Set Cipher to None if empty
if data['cipher'] == u'': if data['cipher'] == '':
data['cipher'] = None data['cipher'] = None
volume_type_id = data.pop('volume_type_id') volume_type_id = data.pop('volume_type_id')

View File

@ -38,16 +38,16 @@ class SpecDeleteKeyValuePair(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Spec", "Delete Spec",
u"Delete Specs", "Delete Specs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Spec", "Deleted Spec",
u"Deleted Specs", "Deleted Specs",
count count
) )

View File

@ -75,16 +75,16 @@ class DeleteVolumeType(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Volume Type", "Delete Volume Type",
u"Delete Volume Types", "Delete Volume Types",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Volume Type", "Deleted Volume Type",
u"Deleted Volume Types", "Deleted Volume Types",
count count
) )
policy_rules = (("volume", "volume_extension:types_manage"),) policy_rules = (("volume", "volume_extension:types_manage"),)
@ -126,16 +126,16 @@ class DeleteVolumeTypeEncryption(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Encryption", "Delete Encryption",
u"Delete Encryptions", "Delete Encryptions",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Encryption", "Deleted Encryption",
u"Deleted Encryptions", "Deleted Encryptions",
count count
) )
@ -293,16 +293,16 @@ class DeleteQosSpecs(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete QoS Spec", "Delete QoS Spec",
u"Delete QoS Specs", "Delete QoS Specs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted QoS Spec", "Deleted QoS Spec",
u"Deleted QoS Specs", "Deleted QoS Specs",
count count
) )
policy_rules = (("volume", "volume_extension:types_manage"),) policy_rules = (("volume", "volume_extension:types_manage"),)

View File

@ -170,13 +170,13 @@ class VolumeTypeTests(test.BaseAdminViewTests):
def test_create_volume_type_encryption(self): def test_create_volume_type_encryption(self):
volume_type1 = self.cinder_volume_types.list()[0] volume_type1 = self.cinder_volume_types.list()[0]
volume_type2 = self.cinder_volume_types.list()[1] volume_type2 = self.cinder_volume_types.list()[1]
volume_type1.id = u'1' volume_type1.id = '1'
volume_type2.id = u'2' volume_type2.id = '2'
volume_type_list = [volume_type1, volume_type2] volume_type_list = [volume_type1, volume_type2]
formData = {'name': u'An Encrypted Volume Type', formData = {'name': 'An Encrypted Volume Type',
'provider': u'a-provider', 'provider': 'a-provider',
'control_location': u'front-end', 'control_location': 'front-end',
'cipher': u'a-cipher', 'cipher': 'a-cipher',
'key_size': 512, 'key_size': 512,
'volume_type_id': volume_type1.id} 'volume_type_id': volume_type1.id}
@ -194,9 +194,9 @@ class VolumeTypeTests(test.BaseAdminViewTests):
self.mock_volume_type_list.assert_called_once_with( self.mock_volume_type_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())
expected = { expected = {
'provider': u'a-provider', 'provider': 'a-provider',
'control_location': u'front-end', 'control_location': 'front-end',
'cipher': u'a-cipher', 'cipher': 'a-cipher',
'key_size': 512, 'key_size': 512,
} }
self.mock_volume_encryption_type_create.assert_called_once_with( self.mock_volume_encryption_type_create.assert_called_once_with(
@ -208,7 +208,7 @@ class VolumeTypeTests(test.BaseAdminViewTests):
'volume_type_list',)}) 'volume_type_list',)})
def test_type_encryption_detail_view_unencrypted(self): def test_type_encryption_detail_view_unencrypted(self):
volume_type1 = self.cinder_volume_types.list()[0] volume_type1 = self.cinder_volume_types.list()[0]
volume_type1.id = u'1' volume_type1.id = '1'
volume_type_list = [volume_type1] volume_type_list = [volume_type1]
vol_unenc_type = self.cinder_volume_encryption_types.list()[2] vol_unenc_type = self.cinder_volume_encryption_types.list()[2]
@ -235,7 +235,7 @@ class VolumeTypeTests(test.BaseAdminViewTests):
'volume_type_list',)}) 'volume_type_list',)})
def test_type_encryption_detail_view_encrypted(self): def test_type_encryption_detail_view_encrypted(self):
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
volume_type.id = u'1' volume_type.id = '1'
volume_type.name = "An Encrypted Volume Name" volume_type.name = "An Encrypted Volume Name"
volume_type_list = [volume_type] volume_type_list = [volume_type]
vol_enc_type = self.cinder_volume_encryption_types.list()[0] vol_enc_type = self.cinder_volume_encryption_types.list()[0]
@ -274,7 +274,7 @@ class VolumeTypeTests(test.BaseAdminViewTests):
'volume_encryption_type_delete',)}) 'volume_encryption_type_delete',)})
def test_delete_volume_type_encryption(self): def test_delete_volume_type_encryption(self):
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
volume_type.id = u'1' volume_type.id = '1'
formData = {'action': 'volume_types__delete_encryption__%s' % formData = {'action': 'volume_types__delete_encryption__%s' %
volume_type.id} volume_type.id}
encryption_list = (self.cinder_volume_encryption_types.list()[0], encryption_list = (self.cinder_volume_encryption_types.list()[0],
@ -307,12 +307,12 @@ class VolumeTypeTests(test.BaseAdminViewTests):
'volume_type_list')}) 'volume_type_list')})
def test_update_volume_type_encryption(self): def test_update_volume_type_encryption(self):
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
volume_type.id = u'1' volume_type.id = '1'
volume_type_list = [volume_type] volume_type_list = [volume_type]
formData = {'name': u'An Encrypted Volume Type', formData = {'name': 'An Encrypted Volume Type',
'provider': u'a-provider', 'provider': 'a-provider',
'control_location': u'front-end', 'control_location': 'front-end',
'cipher': u'a-cipher', 'cipher': 'a-cipher',
'key_size': 256, 'key_size': 256,
'volume_type_id': volume_type.id} 'volume_type_id': volume_type.id}
vol_enc_type = self.cinder_volume_encryption_types.list()[0] vol_enc_type = self.cinder_volume_encryption_types.list()[0]
@ -335,9 +335,9 @@ class VolumeTypeTests(test.BaseAdminViewTests):
self.mock_volume_type_list.assert_called_once_with( self.mock_volume_type_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())
expected = { expected = {
'provider': u'a-provider', 'provider': 'a-provider',
'control_location': u'front-end', 'control_location': 'front-end',
'cipher': u'a-cipher', 'cipher': 'a-cipher',
'key_size': 256, 'key_size': 256,
} }
self.mock_volume_encryption_type_update.assert_called_once_with( self.mock_volume_encryption_type_update.assert_called_once_with(
@ -352,9 +352,9 @@ class VolumeTypeTests(test.BaseAdminViewTests):
api.keystone: ('tenant_list',)}) api.keystone: ('tenant_list',)})
def _test_edit_volume_type_access(self, exception=False): def _test_edit_volume_type_access(self, exception=False):
volume_type = self.cinder_volume_types.list()[2] volume_type = self.cinder_volume_types.list()[2]
volume_type.id = u'1' volume_type.id = '1'
type_access = self.cinder_type_access.list() type_access = self.cinder_type_access.list()
formData = {'member': [u'3'], formData = {'member': ['3'],
'volume_type_id': volume_type.id} 'volume_type_id': volume_type.id}
self.mock_tenant_list.return_value = [self.tenants.list(), False] self.mock_tenant_list.return_value = [self.tenants.list(), False]
@ -379,9 +379,9 @@ class VolumeTypeTests(test.BaseAdminViewTests):
self.mock_volume_type_access_list.assert_called_once_with( self.mock_volume_type_access_list.assert_called_once_with(
test.IsHttpRequest(), volume_type.id) test.IsHttpRequest(), volume_type.id)
self.mock_volume_type_add_project_access.assert_called_once_with( self.mock_volume_type_add_project_access.assert_called_once_with(
test.IsHttpRequest(), volume_type.id, u'3') test.IsHttpRequest(), volume_type.id, '3')
self.mock_volume_type_remove_project_access.assert_called_once_with( self.mock_volume_type_remove_project_access.assert_called_once_with(
test.IsHttpRequest(), volume_type.id, u'1') test.IsHttpRequest(), volume_type.id, '1')
def test_edit_volume_type_access(self): def test_edit_volume_type_access(self):
self._test_edit_volume_type_access() self._test_edit_volume_type_access()

View File

@ -209,11 +209,11 @@ class VolumeTests(test.BaseAdminViewTests):
api.cinder: ['extension_supported', 'availability_zone_list', api.cinder: ['extension_supported', 'availability_zone_list',
'volume_type_list', 'volume_manage']}) 'volume_type_list', 'volume_manage']})
def test_manage_volume(self): def test_manage_volume(self):
metadata = {'key': u'k1', metadata = {'key': 'k1',
'value': u'v1'} 'value': 'v1'}
form_data = {'host': 'host-1', form_data = {'host': 'host-1',
'identifier': 'vol-1', 'identifier': 'vol-1',
'id_type': u'source-name', 'id_type': 'source-name',
'name': 'name-1', 'name': 'name-1',
'description': 'manage a volume', 'description': 'manage a volume',
'volume_type': 'vol_type_1', 'volume_type': 'vol_type_1',

View File

@ -92,16 +92,16 @@ class DeleteDomainsAction(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Domain", "Delete Domain",
u"Delete Domains", "Delete Domains",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Domain", "Deleted Domain",
u"Deleted Domains", "Deleted Domains",
count count
) )
@ -126,16 +126,16 @@ class DisableDomainsAction(tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Disable Domain", "Disable Domain",
u"Disable Domains", "Disable Domains",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Disabled Domain", "Disabled Domain",
u"Disabled Domains", "Disabled Domains",
count count
) )
@ -166,16 +166,16 @@ class EnableDomainsAction(tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Enable Domain", "Enable Domain",
u"Enable Domains", "Enable Domains",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Enabled Domain", "Enabled Domain",
u"Enabled Domains", "Enabled Domains",
count count
) )

View File

@ -63,16 +63,16 @@ class DeleteGroupsAction(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Group", "Delete Group",
u"Delete Groups", "Delete Groups",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Group", "Deleted Group",
u"Deleted Groups", "Deleted Groups",
count count
) )
@ -131,16 +131,16 @@ class RemoveMembers(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Remove User", "Remove User",
u"Remove Users", "Remove Users",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Removed User", "Removed User",
u"Removed Users", "Removed Users",
count count
) )
@ -207,16 +207,16 @@ class AddMembers(tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Add User", "Add User",
u"Add Users", "Add Users",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Added User", "Added User",
u"Added Users", "Added Users",
count count
) )

View File

@ -38,16 +38,16 @@ class RemoveProtocol(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Protocol", "Delete Protocol",
u"Delete Protocols", "Delete Protocols",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Protocol", "Deleted Protocol",
u"Deleted Protocols", "Deleted Protocols",
count count
) )

View File

@ -51,16 +51,16 @@ class DeleteIdPsAction(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Unregister Identity Provider", "Unregister Identity Provider",
u"Unregister Identity Providers", "Unregister Identity Providers",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Unregistered Identity Provider", "Unregistered Identity Provider",
u"Unregistered Identity Providers", "Unregistered Identity Providers",
count count
) )
policy_rules = (("identity", "identity:delete_identity_provider"),) policy_rules = (("identity", "identity:delete_identity_provider"),)

View File

@ -44,16 +44,16 @@ class DeleteMappingsAction(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Mapping", "Delete Mapping",
u"Delete Mappings", "Delete Mappings",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Mapping", "Deleted Mapping",
u"Deleted Mappings", "Deleted Mappings",
count count
) )
policy_rules = (("identity", "identity:delete_mapping"),) policy_rules = (("identity", "identity:delete_mapping"),)

View File

@ -160,16 +160,16 @@ class DeleteTenantsAction(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Project", "Delete Project",
u"Delete Projects", "Delete Projects",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Project", "Deleted Project",
u"Deleted Projects", "Deleted Projects",
count count
) )

View File

@ -48,16 +48,16 @@ class DeleteRolesAction(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Role", "Delete Role",
u"Delete Roles", "Delete Roles",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Role", "Deleted Role",
u"Deleted Roles", "Deleted Roles",
count count
) )
policy_rules = (("identity", "identity:delete_role"),) policy_rules = (("identity", "identity:delete_role"),)

View File

@ -76,13 +76,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction):
def action_present(count): def action_present(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Enable User", "Enable User",
u"Enable Users", "Enable Users",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Disable User", "Disable User",
u"Disable Users", "Disable Users",
count count
), ),
) )
@ -91,13 +91,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction):
def action_past(count): def action_past(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Enabled User", "Enabled User",
u"Enabled Users", "Enabled Users",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Disabled User", "Disabled User",
u"Disabled Users", "Disabled Users",
count count
), ),
) )
@ -134,16 +134,16 @@ class DeleteUsersAction(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete User", "Delete User",
u"Delete Users", "Delete Users",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted User", "Deleted User",
u"Deleted Users", "Deleted Users",
count count
) )
policy_rules = (("identity", "identity:delete_user"),) policy_rules = (("identity", "identity:delete_user"),)

View File

@ -855,8 +855,8 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.post(USERS_INDEX_URL, formData, follow=True) res = self.client.post(USERS_INDEX_URL, formData, follow=True)
self.assertEqual(list(res.context['messages'])[0].message, self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to disable user: ' 'You are not allowed to disable user: '
u'test_user') 'test_user')
self.assert_mock_multiple_calls_with_same_arguments( self.assert_mock_multiple_calls_with_same_arguments(
self.mock_get_effective_domain_id, 2, self.mock_get_effective_domain_id, 2,
@ -889,8 +889,8 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.post(USERS_INDEX_URL, formData, follow=True) res = self.client.post(USERS_INDEX_URL, formData, follow=True)
self.assertEqual(list(res.context['messages'])[0].message, self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to disable user: ' 'You are not allowed to disable user: '
u'test_user') 'test_user')
self.assert_mock_multiple_calls_with_same_arguments( self.assert_mock_multiple_calls_with_same_arguments(
self.mock_get_effective_domain_id, 2, self.mock_get_effective_domain_id, 2,
@ -919,7 +919,7 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.post(USERS_INDEX_URL, formData, follow=True) res = self.client.post(USERS_INDEX_URL, formData, follow=True)
self.assertEqual(list(res.context['messages'])[0].message, self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to delete user: %s' 'You are not allowed to delete user: %s'
% self.request.user.username) % self.request.user.username)
self.assert_mock_multiple_calls_with_same_arguments( self.assert_mock_multiple_calls_with_same_arguments(
@ -953,7 +953,7 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.post(USERS_INDEX_URL, formData, follow=True) res = self.client.post(USERS_INDEX_URL, formData, follow=True)
self.assertEqual(list(res.context['messages'])[0].message, self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to delete user: %s' 'You are not allowed to delete user: %s'
% self.request.user.username) % self.request.user.username)
self.assert_mock_multiple_calls_with_same_arguments( self.assert_mock_multiple_calls_with_same_arguments(

View File

@ -132,7 +132,7 @@ class ASCIITenantNameRCTests(test.TestCase):
class UnicodeTenantNameRCTests(test.TestCase): class UnicodeTenantNameRCTests(test.TestCase):
TENANT_NAME = u'\u043f\u0440\u043e\u0435\u043a\u0442' TENANT_NAME = '\u043f\u0440\u043e\u0435\u043a\u0442'
def _setup_user(self, **kwargs): def _setup_user(self, **kwargs):
super()._setup_user(tenant_name=self.TENANT_NAME) super()._setup_user(tenant_name=self.TENANT_NAME)

View File

@ -69,16 +69,16 @@ class DeleteBackup(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Volume Backup", "Delete Volume Backup",
u"Delete Volume Backups", "Delete Volume Backups",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of Volume Backup", "Scheduled deletion of Volume Backup",
u"Scheduled deletion of Volume Backups", "Scheduled deletion of Volume Backups",
count count
) )
@ -145,17 +145,17 @@ class BackupsTable(tables.DataTable):
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("available", pgettext_lazy("Current status of a Volume Backup", ("available", pgettext_lazy("Current status of a Volume Backup",
u"Available")), "Available")),
("error", pgettext_lazy("Current status of a Volume Backup", ("error", pgettext_lazy("Current status of a Volume Backup",
u"Error")), "Error")),
("creating", pgettext_lazy("Current status of a Volume Backup", ("creating", pgettext_lazy("Current status of a Volume Backup",
u"Creating")), "Creating")),
("restoring", pgettext_lazy("Current status of a Volume Backup", ("restoring", pgettext_lazy("Current status of a Volume Backup",
u"Restoring")), "Restoring")),
("deleting", pgettext_lazy("Current status of a Volume Backup", ("deleting", pgettext_lazy("Current status of a Volume Backup",
u"Deleting")), "Deleting")),
("error_restoring", pgettext_lazy("Current status of a Volume Backup", ("error_restoring", pgettext_lazy("Current status of a Volume Backup",
u"Error Restoring")), "Error Restoring")),
) )
name = tables.Column("name", name = tables.Column("name",
verbose_name=_("Name"), verbose_name=_("Name"),

View File

@ -75,16 +75,16 @@ class ReleaseIPs(tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Release Floating IP", "Release Floating IP",
u"Release Floating IPs", "Release Floating IPs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Released Floating IP", "Released Floating IP",
u"Released Floating IPs", "Released Floating IPs",
count count
) )
@ -158,9 +158,9 @@ def get_instance_link(datum):
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("Current status of a Floating IP", u"Active")), ("active", pgettext_lazy("Current status of a Floating IP", "Active")),
("down", pgettext_lazy("Current status of a Floating IP", u"Down")), ("down", pgettext_lazy("Current status of a Floating IP", "Down")),
("error", pgettext_lazy("Current status of a Floating IP", u"Error")), ("error", pgettext_lazy("Current status of a Floating IP", "Error")),
) )

View File

@ -90,16 +90,16 @@ class DeleteImage(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Image", "Delete Image",
u"Delete Images", "Delete Images",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Image", "Deleted Image",
u"Deleted Images", "Deleted Images",
count count
) )
@ -266,10 +266,10 @@ def get_format(image):
if format == "raw": if format == "raw":
if getattr(image, "container_format") == 'docker': if getattr(image, "container_format") == 'docker':
return pgettext_lazy("Image format for display in table", return pgettext_lazy("Image format for display in table",
u"Docker") "Docker")
# Most image formats are untranslated acronyms, but raw is a word # Most image formats are untranslated acronyms, but raw is a word
# and should be translated # and should be translated
return pgettext_lazy("Image format for display in table", u"Raw") return pgettext_lazy("Image format for display in table", "Raw")
return format.upper() return format.upper()
@ -301,19 +301,19 @@ class ImagesTable(tables.DataTable):
("deactivated", False), ("deactivated", False),
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("Current status of an Image", u"Active")), ("active", pgettext_lazy("Current status of an Image", "Active")),
("saving", pgettext_lazy("Current status of an Image", u"Saving")), ("saving", pgettext_lazy("Current status of an Image", "Saving")),
("queued", pgettext_lazy("Current status of an Image", u"Queued")), ("queued", pgettext_lazy("Current status of an Image", "Queued")),
("pending_delete", pgettext_lazy("Current status of an Image", ("pending_delete", pgettext_lazy("Current status of an Image",
u"Pending Delete")), "Pending Delete")),
("killed", pgettext_lazy("Current status of an Image", u"Killed")), ("killed", pgettext_lazy("Current status of an Image", "Killed")),
("deleted", pgettext_lazy("Current status of an Image", u"Deleted")), ("deleted", pgettext_lazy("Current status of an Image", "Deleted")),
("deactivated", pgettext_lazy("Current status of an Image", ("deactivated", pgettext_lazy("Current status of an Image",
u"Deactivated")), "Deactivated")),
) )
TYPE_CHOICES = ( TYPE_CHOICES = (
("image", pgettext_lazy("Type of an image", u"Image")), ("image", pgettext_lazy("Type of an image", "Image")),
("snapshot", pgettext_lazy("Type of an image", u"Snapshot")), ("snapshot", pgettext_lazy("Type of an image", "Snapshot")),
) )
name = tables.WrappingColumn(get_image_name, name = tables.WrappingColumn(get_image_name,
link="horizon:project:images:images:detail", link="horizon:project:images:images:detail",

View File

@ -50,11 +50,11 @@ class CreateImageFormTests(test.ResetImageAPIVersionMixin, test.TestCase):
] ]
post = { post = {
'name': u'Ubuntu 11.10', 'name': 'Ubuntu 11.10',
'source_type': u'file', 'source_type': 'file',
'description': u'Login with admin/admin', 'description': 'Login with admin/admin',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'architecture': u'x86-64', 'architecture': 'x86-64',
'min_disk': 15, 'min_disk': 15,
'min_ram': 512, 'min_ram': 512,
'is_public': 1} 'is_public': 1}
@ -91,15 +91,15 @@ class UpdateImageFormTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_image_update_post_v2(self, mock_image_update, mock_image_get): def test_image_update_post_v2(self, mock_image_update, mock_image_get):
image = self.images.first() image = self.images.first()
data = { data = {
'name': u'Ubuntu 11.10', 'name': 'Ubuntu 11.10',
'image_id': str(image.id), 'image_id': str(image.id),
'description': u'Login with admin/admin', 'description': 'Login with admin/admin',
'source_type': u'url', 'source_type': 'url',
'image_url': u'http://cloud-images.ubuntu.com/releases/' 'image_url': 'http://cloud-images.ubuntu.com/releases/'
u'oneiric/release/ubuntu-11.10-server-cloudimg' 'oneiric/release/ubuntu-11.10-server-cloudimg'
u'-amd64-disk1.img', '-amd64-disk1.img',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'architecture': u'x86-64', 'architecture': 'x86-64',
'min_disk': 15, 'min_disk': 15,
'min_ram': 512, 'min_ram': 512,
'is_public': False, 'is_public': False,
@ -155,10 +155,10 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_image_create_post_location_v2(self, mock_schemas_list): def test_image_create_post_location_v2(self, mock_schemas_list):
mock_schemas_list.return_value = self.image_schemas.first() mock_schemas_list.return_value = self.image_schemas.first()
data = { data = {
'source_type': u'url', 'source_type': 'url',
'image_url': u'http://cloud-images.ubuntu.com/releases/' 'image_url': 'http://cloud-images.ubuntu.com/releases/'
u'oneiric/release/ubuntu-11.10-server-cloudimg' 'oneiric/release/ubuntu-11.10-server-cloudimg'
u'-amd64-disk1.img'} '-amd64-disk1.img'}
api_data = {'location': data['image_url']} api_data = {'location': data['image_url']}
self._test_image_create(data, api_data) self._test_image_create(data, api_data)
@ -171,7 +171,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
temp_file.flush() temp_file.flush()
temp_file.seek(0) temp_file.seek(0)
data = {'source_type': u'file', data = {'source_type': 'file',
'image_file': temp_file} 'image_file': temp_file}
api_data = {'data': test.IsA(InMemoryUploadedFile)} api_data = {'data': test.IsA(InMemoryUploadedFile)}
@ -186,7 +186,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
temp_file.seek(0) temp_file.seek(0)
data = { data = {
'source_type': u'file', 'source_type': 'file',
'image_file': temp_file, 'image_file': temp_file,
'kernel_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482e', 'kernel_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482e',
'ramdisk_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482a' 'ramdisk_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482a'
@ -200,10 +200,10 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def _test_image_create(self, extra_form_data, extra_api_data, def _test_image_create(self, extra_form_data, extra_api_data,
mock_image_list, mock_image_create): mock_image_list, mock_image_create):
data = { data = {
'name': u'Ubuntu 11.10', 'name': 'Ubuntu 11.10',
'description': u'Login with admin/admin', 'description': 'Login with admin/admin',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'architecture': u'x86-64', 'architecture': 'x86-64',
'min_disk': 15, 'min_disk': 15,
'min_ram': 512, 'min_ram': 512,
'is_public': True, 'is_public': True,

View File

@ -115,23 +115,23 @@ class ImagesAndSnapshotsTests(BaseImagesTestCase):
# first instance - status active, owned # first instance - status active, owned
self.assertEqual(len(row_actions), 5) self.assertEqual(len(row_actions), 5)
self.assertEqual(row_actions[0].verbose_name, u"Launch") self.assertEqual(row_actions[0].verbose_name, "Launch")
self.assertEqual(row_actions[1].verbose_name, u"Create Volume") self.assertEqual(row_actions[1].verbose_name, "Create Volume")
self.assertEqual(row_actions[2].verbose_name, u"Edit Image") self.assertEqual(row_actions[2].verbose_name, "Edit Image")
self.assertEqual(row_actions[3].verbose_name, u"Update Metadata") self.assertEqual(row_actions[3].verbose_name, "Update Metadata")
self.assertEqual(row_actions[4].verbose_name, u"Delete Image") self.assertEqual(row_actions[4].verbose_name, "Delete Image")
row_actions = snaps.get_row_actions(snaps.data[1]) row_actions = snaps.get_row_actions(snaps.data[1])
# second instance - status active, not owned # second instance - status active, not owned
self.assertEqual(len(row_actions), 2) self.assertEqual(len(row_actions), 2)
self.assertEqual(row_actions[0].verbose_name, u"Launch") self.assertEqual(row_actions[0].verbose_name, "Launch")
self.assertEqual(row_actions[1].verbose_name, u"Create Volume") self.assertEqual(row_actions[1].verbose_name, "Create Volume")
row_actions = snaps.get_row_actions(snaps.data[2]) row_actions = snaps.get_row_actions(snaps.data[2])
# third instance - status queued, only delete is available # third instance - status queued, only delete is available
self.assertEqual(len(row_actions), 1) self.assertEqual(len(row_actions), 1)
self.assertEqual(row_actions[0].verbose_name, u"Delete Image") self.assertEqual(row_actions[0].verbose_name, "Delete Image")
self.assertEqual(str(row_actions[0]), "<DeleteImage: delete>") self.assertEqual(str(row_actions[0]), "<DeleteImage: delete>")
self.mock_image_list.assert_called_once_with(test.IsHttpRequest(), self.mock_image_list.assert_called_once_with(test.IsHttpRequest(),

View File

@ -22,27 +22,27 @@ from horizon.utils import filters
class AuditTable(tables.DataTable): class AuditTable(tables.DataTable):
ACTION_DISPLAY_CHOICES = ( ACTION_DISPLAY_CHOICES = (
("create", pgettext_lazy("Action log of an instance", u"Create")), ("create", pgettext_lazy("Action log of an instance", "Create")),
("pause", pgettext_lazy("Action log of an instance", u"Pause")), ("pause", pgettext_lazy("Action log of an instance", "Pause")),
("unpause", pgettext_lazy("Action log of an instance", u"Unpause")), ("unpause", pgettext_lazy("Action log of an instance", "Unpause")),
("rebuild", pgettext_lazy("Action log of an instance", u"Rebuild")), ("rebuild", pgettext_lazy("Action log of an instance", "Rebuild")),
("resize", pgettext_lazy("Action log of an instance", u"Resize")), ("resize", pgettext_lazy("Action log of an instance", "Resize")),
("confirmresize", pgettext_lazy("Action log of an instance", ("confirmresize", pgettext_lazy("Action log of an instance",
u"Confirm Resize")), "Confirm Resize")),
("suspend", pgettext_lazy("Action log of an instance", u"Suspend")), ("suspend", pgettext_lazy("Action log of an instance", "Suspend")),
("resume", pgettext_lazy("Action log of an instance", u"Resume")), ("resume", pgettext_lazy("Action log of an instance", "Resume")),
("reboot", pgettext_lazy("Action log of an instance", u"Reboot")), ("reboot", pgettext_lazy("Action log of an instance", "Reboot")),
("stop", pgettext_lazy("Action log of an instance", u"Stop")), ("stop", pgettext_lazy("Action log of an instance", "Stop")),
("start", pgettext_lazy("Action log of an instance", u"Start")), ("start", pgettext_lazy("Action log of an instance", "Start")),
("shelve", pgettext_lazy("Action log of an instance", u"Shelve")), ("shelve", pgettext_lazy("Action log of an instance", "Shelve")),
("unshelve", pgettext_lazy("Action log of an instance", u"Unshelve")), ("unshelve", pgettext_lazy("Action log of an instance", "Unshelve")),
("migrate", pgettext_lazy("Action log of an instance", u"Migrate")), ("migrate", pgettext_lazy("Action log of an instance", "Migrate")),
("rescue", pgettext_lazy("Action log of an instance", u"Rescue")), ("rescue", pgettext_lazy("Action log of an instance", "Rescue")),
("unrescue", pgettext_lazy("Action log of an instance", u"Unrescue")), ("unrescue", pgettext_lazy("Action log of an instance", "Unrescue")),
("lock", pgettext_lazy("Action log of an instance", u"Lock")), ("lock", pgettext_lazy("Action log of an instance", "Lock")),
("unlock", pgettext_lazy("Action log of an instance", u"Unlock")), ("unlock", pgettext_lazy("Action log of an instance", "Unlock")),
("createimage", pgettext_lazy("Action log of an instance", ("createimage", pgettext_lazy("Action log of an instance",
u"Create Image")), "Create Image")),
) )
request_id = tables.Column('request_id', request_id = tables.Column('request_id',

View File

@ -89,16 +89,16 @@ class DeleteInstance(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Instance", "Delete Instance",
u"Delete Instances", "Delete Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of Instance", "Scheduled deletion of Instance",
u"Scheduled deletion of Instances", "Scheduled deletion of Instances",
count count
) )
@ -123,16 +123,16 @@ class RebootInstance(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Hard Reboot Instance", "Hard Reboot Instance",
u"Hard Reboot Instances", "Hard Reboot Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Hard Rebooted Instance", "Hard Rebooted Instance",
u"Hard Rebooted Instances", "Hard Rebooted Instances",
count count
) )
@ -153,16 +153,16 @@ class SoftRebootInstance(RebootInstance):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Soft Reboot Instance", "Soft Reboot Instance",
u"Soft Reboot Instances", "Soft Reboot Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Soft Rebooted Instance", "Soft Rebooted Instance",
u"Soft Rebooted Instances", "Soft Rebooted Instances",
count count
) )
@ -197,16 +197,16 @@ class UnRescueInstance(tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Unrescue Instance", "Unrescue Instance",
u"Unrescue Instances", "Unrescue Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Unrescued Instance", "Unrescued Instance",
u"Unrescued Instances", "Unrescued Instances",
count count
) )
@ -227,13 +227,13 @@ class TogglePause(tables.BatchAction):
def action_present(count): def action_present(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Pause Instance", "Pause Instance",
u"Pause Instances", "Pause Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Resume Instance", "Resume Instance",
u"Resume Instances", "Resume Instances",
count count
), ),
) )
@ -242,13 +242,13 @@ class TogglePause(tables.BatchAction):
def action_past(count): def action_past(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Paused Instance", "Paused Instance",
u"Paused Instances", "Paused Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Resumed Instance", "Resumed Instance",
u"Resumed Instances", "Resumed Instances",
count count
), ),
) )
@ -291,13 +291,13 @@ class ToggleSuspend(tables.BatchAction):
def action_present(count): def action_present(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Suspend Instance", "Suspend Instance",
u"Suspend Instances", "Suspend Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Resume Instance", "Resume Instance",
u"Resume Instances", "Resume Instances",
count count
), ),
) )
@ -306,13 +306,13 @@ class ToggleSuspend(tables.BatchAction):
def action_past(count): def action_past(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Suspended Instance", "Suspended Instance",
u"Suspended Instances", "Suspended Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Resumed Instance", "Resumed Instance",
u"Resumed Instances", "Resumed Instances",
count count
), ),
) )
@ -355,13 +355,13 @@ class ToggleShelve(tables.BatchAction):
def action_present(count): def action_present(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Shelve Instance", "Shelve Instance",
u"Shelve Instances", "Shelve Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Unshelve Instance", "Unshelve Instance",
u"Unshelve Instances", "Unshelve Instances",
count count
), ),
) )
@ -370,13 +370,13 @@ class ToggleShelve(tables.BatchAction):
def action_past(count): def action_past(count):
return ( return (
ungettext_lazy( ungettext_lazy(
u"Shelved Instance", "Shelved Instance",
u"Shelved Instances", "Shelved Instances",
count count
), ),
ungettext_lazy( ungettext_lazy(
u"Unshelved Instance", "Unshelved Instance",
u"Unshelved Instances", "Unshelved Instances",
count count
), ),
) )
@ -817,16 +817,16 @@ class StartInstance(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Start Instance", "Start Instance",
u"Start Instances", "Start Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Started Instance", "Started Instance",
u"Started Instances", "Started Instances",
count count
) )
@ -848,8 +848,8 @@ class StopInstance(policy.PolicyTargetMixin, tables.BatchAction):
def action_present(count): def action_present(count):
return npgettext_lazy( return npgettext_lazy(
"Action to perform (the instance is currently running)", "Action to perform (the instance is currently running)",
u"Shut Off Instance", "Shut Off Instance",
u"Shut Off Instances", "Shut Off Instances",
count count
) )
@ -857,8 +857,8 @@ class StopInstance(policy.PolicyTargetMixin, tables.BatchAction):
def action_past(count): def action_past(count):
return npgettext_lazy( return npgettext_lazy(
"Past action (the instance is currently already Shut Off)", "Past action (the instance is currently already Shut Off)",
u"Shut Off Instance", "Shut Off Instance",
u"Shut Off Instances", "Shut Off Instances",
count count
) )
@ -878,16 +878,16 @@ class LockInstance(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Lock Instance", "Lock Instance",
u"Lock Instances", "Lock Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Locked Instance", "Locked Instance",
u"Locked Instances", "Locked Instances",
count count
) )
@ -910,16 +910,16 @@ class UnlockInstance(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Unlock Instance", "Unlock Instance",
u"Unlock Instances", "Unlock Instances",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Unlocked Instance", "Unlocked Instance",
u"Unlocked Instances", "Unlocked Instances",
count count
) )
@ -1059,131 +1059,131 @@ def get_power_state(instance):
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("deleted", pgettext_lazy("Current status of an Instance", u"Deleted")), ("deleted", pgettext_lazy("Current status of an Instance", "Deleted")),
("active", pgettext_lazy("Current status of an Instance", u"Active")), ("active", pgettext_lazy("Current status of an Instance", "Active")),
("shutoff", pgettext_lazy("Current status of an Instance", u"Shutoff")), ("shutoff", pgettext_lazy("Current status of an Instance", "Shutoff")),
("suspended", pgettext_lazy("Current status of an Instance", ("suspended", pgettext_lazy("Current status of an Instance",
u"Suspended")), "Suspended")),
("paused", pgettext_lazy("Current status of an Instance", u"Paused")), ("paused", pgettext_lazy("Current status of an Instance", "Paused")),
("error", pgettext_lazy("Current status of an Instance", u"Error")), ("error", pgettext_lazy("Current status of an Instance", "Error")),
("resize", pgettext_lazy("Current status of an Instance", ("resize", pgettext_lazy("Current status of an Instance",
u"Resize/Migrate")), "Resize/Migrate")),
("verify_resize", pgettext_lazy("Current status of an Instance", ("verify_resize", pgettext_lazy("Current status of an Instance",
u"Confirm or Revert Resize/Migrate")), "Confirm or Revert Resize/Migrate")),
("revert_resize", pgettext_lazy( ("revert_resize", pgettext_lazy(
"Current status of an Instance", u"Revert Resize/Migrate")), "Current status of an Instance", "Revert Resize/Migrate")),
("reboot", pgettext_lazy("Current status of an Instance", u"Reboot")), ("reboot", pgettext_lazy("Current status of an Instance", "Reboot")),
("hard_reboot", pgettext_lazy("Current status of an Instance", ("hard_reboot", pgettext_lazy("Current status of an Instance",
u"Hard Reboot")), "Hard Reboot")),
("password", pgettext_lazy("Current status of an Instance", u"Password")), ("password", pgettext_lazy("Current status of an Instance", "Password")),
("rebuild", pgettext_lazy("Current status of an Instance", u"Rebuild")), ("rebuild", pgettext_lazy("Current status of an Instance", "Rebuild")),
("migrating", pgettext_lazy("Current status of an Instance", ("migrating", pgettext_lazy("Current status of an Instance",
u"Migrating")), "Migrating")),
("build", pgettext_lazy("Current status of an Instance", u"Build")), ("build", pgettext_lazy("Current status of an Instance", "Build")),
("rescue", pgettext_lazy("Current status of an Instance", u"Rescue")), ("rescue", pgettext_lazy("Current status of an Instance", "Rescue")),
("soft-delete", pgettext_lazy("Current status of an Instance", ("soft-delete", pgettext_lazy("Current status of an Instance",
u"Soft Deleted")), "Soft Deleted")),
("shelved", pgettext_lazy("Current status of an Instance", u"Shelved")), ("shelved", pgettext_lazy("Current status of an Instance", "Shelved")),
("shelved_offloaded", pgettext_lazy("Current status of an Instance", ("shelved_offloaded", pgettext_lazy("Current status of an Instance",
u"Shelved Offloaded")), "Shelved Offloaded")),
# these vm states are used when generating CSV usage summary # these vm states are used when generating CSV usage summary
("building", pgettext_lazy("Current status of an Instance", u"Building")), ("building", pgettext_lazy("Current status of an Instance", "Building")),
("stopped", pgettext_lazy("Current status of an Instance", u"Stopped")), ("stopped", pgettext_lazy("Current status of an Instance", "Stopped")),
("rescued", pgettext_lazy("Current status of an Instance", u"Rescued")), ("rescued", pgettext_lazy("Current status of an Instance", "Rescued")),
("resized", pgettext_lazy("Current status of an Instance", u"Resized")), ("resized", pgettext_lazy("Current status of an Instance", "Resized")),
) )
TASK_DISPLAY_NONE = pgettext_lazy("Task status of an Instance", u"None") TASK_DISPLAY_NONE = pgettext_lazy("Task status of an Instance", "None")
# Mapping of task states taken from Nova's nova/compute/task_states.py # Mapping of task states taken from Nova's nova/compute/task_states.py
TASK_DISPLAY_CHOICES = ( TASK_DISPLAY_CHOICES = (
("scheduling", pgettext_lazy("Task status of an Instance", ("scheduling", pgettext_lazy("Task status of an Instance",
u"Scheduling")), "Scheduling")),
("block_device_mapping", pgettext_lazy("Task status of an Instance", ("block_device_mapping", pgettext_lazy("Task status of an Instance",
u"Block Device Mapping")), "Block Device Mapping")),
("networking", pgettext_lazy("Task status of an Instance", ("networking", pgettext_lazy("Task status of an Instance",
u"Networking")), "Networking")),
("spawning", pgettext_lazy("Task status of an Instance", u"Spawning")), ("spawning", pgettext_lazy("Task status of an Instance", "Spawning")),
("image_snapshot", pgettext_lazy("Task status of an Instance", ("image_snapshot", pgettext_lazy("Task status of an Instance",
u"Snapshotting")), "Snapshotting")),
("image_snapshot_pending", pgettext_lazy("Task status of an Instance", ("image_snapshot_pending", pgettext_lazy("Task status of an Instance",
u"Image Snapshot Pending")), "Image Snapshot Pending")),
("image_pending_upload", pgettext_lazy("Task status of an Instance", ("image_pending_upload", pgettext_lazy("Task status of an Instance",
u"Image Pending Upload")), "Image Pending Upload")),
("image_uploading", pgettext_lazy("Task status of an Instance", ("image_uploading", pgettext_lazy("Task status of an Instance",
u"Image Uploading")), "Image Uploading")),
("image_backup", pgettext_lazy("Task status of an Instance", ("image_backup", pgettext_lazy("Task status of an Instance",
u"Image Backup")), "Image Backup")),
("updating_password", pgettext_lazy("Task status of an Instance", ("updating_password", pgettext_lazy("Task status of an Instance",
u"Updating Password")), "Updating Password")),
("resize_prep", pgettext_lazy("Task status of an Instance", ("resize_prep", pgettext_lazy("Task status of an Instance",
u"Preparing Resize or Migrate")), "Preparing Resize or Migrate")),
("resize_migrating", pgettext_lazy("Task status of an Instance", ("resize_migrating", pgettext_lazy("Task status of an Instance",
u"Resizing or Migrating")), "Resizing or Migrating")),
("resize_migrated", pgettext_lazy("Task status of an Instance", ("resize_migrated", pgettext_lazy("Task status of an Instance",
u"Resized or Migrated")), "Resized or Migrated")),
("resize_finish", pgettext_lazy("Task status of an Instance", ("resize_finish", pgettext_lazy("Task status of an Instance",
u"Finishing Resize or Migrate")), "Finishing Resize or Migrate")),
("resize_reverting", pgettext_lazy("Task status of an Instance", ("resize_reverting", pgettext_lazy("Task status of an Instance",
u"Reverting Resize or Migrate")), "Reverting Resize or Migrate")),
("resize_confirming", pgettext_lazy("Task status of an Instance", ("resize_confirming", pgettext_lazy("Task status of an Instance",
u"Confirming Resize or Migrate")), "Confirming Resize or Migrate")),
("rebooting", pgettext_lazy("Task status of an Instance", u"Rebooting")), ("rebooting", pgettext_lazy("Task status of an Instance", "Rebooting")),
("reboot_pending", pgettext_lazy("Task status of an Instance", ("reboot_pending", pgettext_lazy("Task status of an Instance",
u"Reboot Pending")), "Reboot Pending")),
("reboot_started", pgettext_lazy("Task status of an Instance", ("reboot_started", pgettext_lazy("Task status of an Instance",
u"Reboot Started")), "Reboot Started")),
("rebooting_hard", pgettext_lazy("Task status of an Instance", ("rebooting_hard", pgettext_lazy("Task status of an Instance",
u"Hard Rebooting")), "Hard Rebooting")),
("reboot_pending_hard", pgettext_lazy("Task status of an Instance", ("reboot_pending_hard", pgettext_lazy("Task status of an Instance",
u"Hard Reboot Pending")), "Hard Reboot Pending")),
("reboot_started_hard", pgettext_lazy("Task status of an Instance", ("reboot_started_hard", pgettext_lazy("Task status of an Instance",
u"Hard Reboot Started")), "Hard Reboot Started")),
("pausing", pgettext_lazy("Task status of an Instance", u"Pausing")), ("pausing", pgettext_lazy("Task status of an Instance", "Pausing")),
("unpausing", pgettext_lazy("Task status of an Instance", u"Resuming")), ("unpausing", pgettext_lazy("Task status of an Instance", "Resuming")),
("suspending", pgettext_lazy("Task status of an Instance", ("suspending", pgettext_lazy("Task status of an Instance",
u"Suspending")), "Suspending")),
("resuming", pgettext_lazy("Task status of an Instance", u"Resuming")), ("resuming", pgettext_lazy("Task status of an Instance", "Resuming")),
("powering-off", pgettext_lazy("Task status of an Instance", ("powering-off", pgettext_lazy("Task status of an Instance",
u"Powering Off")), "Powering Off")),
("powering-on", pgettext_lazy("Task status of an Instance", ("powering-on", pgettext_lazy("Task status of an Instance",
u"Powering On")), "Powering On")),
("rescuing", pgettext_lazy("Task status of an Instance", u"Rescuing")), ("rescuing", pgettext_lazy("Task status of an Instance", "Rescuing")),
("unrescuing", pgettext_lazy("Task status of an Instance", ("unrescuing", pgettext_lazy("Task status of an Instance",
u"Unrescuing")), "Unrescuing")),
("rebuilding", pgettext_lazy("Task status of an Instance", ("rebuilding", pgettext_lazy("Task status of an Instance",
u"Rebuilding")), "Rebuilding")),
("rebuild_block_device_mapping", pgettext_lazy( ("rebuild_block_device_mapping", pgettext_lazy(
"Task status of an Instance", u"Rebuild Block Device Mapping")), "Task status of an Instance", "Rebuild Block Device Mapping")),
("rebuild_spawning", pgettext_lazy("Task status of an Instance", ("rebuild_spawning", pgettext_lazy("Task status of an Instance",
u"Rebuild Spawning")), "Rebuild Spawning")),
("migrating", pgettext_lazy("Task status of an Instance", u"Migrating")), ("migrating", pgettext_lazy("Task status of an Instance", "Migrating")),
("deleting", pgettext_lazy("Task status of an Instance", u"Deleting")), ("deleting", pgettext_lazy("Task status of an Instance", "Deleting")),
("soft-deleting", pgettext_lazy("Task status of an Instance", ("soft-deleting", pgettext_lazy("Task status of an Instance",
u"Soft Deleting")), "Soft Deleting")),
("restoring", pgettext_lazy("Task status of an Instance", u"Restoring")), ("restoring", pgettext_lazy("Task status of an Instance", "Restoring")),
("shelving", pgettext_lazy("Task status of an Instance", u"Shelving")), ("shelving", pgettext_lazy("Task status of an Instance", "Shelving")),
("shelving_image_pending_upload", pgettext_lazy( ("shelving_image_pending_upload", pgettext_lazy(
"Task status of an Instance", u"Shelving Image Pending Upload")), "Task status of an Instance", "Shelving Image Pending Upload")),
("shelving_image_uploading", pgettext_lazy("Task status of an Instance", ("shelving_image_uploading", pgettext_lazy("Task status of an Instance",
u"Shelving Image Uploading")), "Shelving Image Uploading")),
("shelving_offloading", pgettext_lazy("Task status of an Instance", ("shelving_offloading", pgettext_lazy("Task status of an Instance",
u"Shelving Offloading")), "Shelving Offloading")),
("unshelving", pgettext_lazy("Task status of an Instance", ("unshelving", pgettext_lazy("Task status of an Instance",
u"Unshelving")), "Unshelving")),
) )
POWER_DISPLAY_CHOICES = ( POWER_DISPLAY_CHOICES = (
("NO STATE", pgettext_lazy("Power state of an Instance", u"No State")), ("NO STATE", pgettext_lazy("Power state of an Instance", "No State")),
("RUNNING", pgettext_lazy("Power state of an Instance", u"Running")), ("RUNNING", pgettext_lazy("Power state of an Instance", "Running")),
("BLOCKED", pgettext_lazy("Power state of an Instance", u"Blocked")), ("BLOCKED", pgettext_lazy("Power state of an Instance", "Blocked")),
("PAUSED", pgettext_lazy("Power state of an Instance", u"Paused")), ("PAUSED", pgettext_lazy("Power state of an Instance", "Paused")),
("SHUTDOWN", pgettext_lazy("Power state of an Instance", u"Shut Down")), ("SHUTDOWN", pgettext_lazy("Power state of an Instance", "Shut Down")),
("SHUTOFF", pgettext_lazy("Power state of an Instance", u"Shut Off")), ("SHUTOFF", pgettext_lazy("Power state of an Instance", "Shut Off")),
("CRASHED", pgettext_lazy("Power state of an Instance", u"Crashed")), ("CRASHED", pgettext_lazy("Power state of an Instance", "Crashed")),
("SUSPENDED", pgettext_lazy("Power state of an Instance", u"Suspended")), ("SUSPENDED", pgettext_lazy("Power state of an Instance", "Suspended")),
("FAILED", pgettext_lazy("Power state of an Instance", u"Failed")), ("FAILED", pgettext_lazy("Power state of an Instance", "Failed")),
("BUILDING", pgettext_lazy("Power state of an Instance", u"Building")), ("BUILDING", pgettext_lazy("Power state of an Instance", "Building")),
) )
INSTANCE_FILTER_CHOICES = ( INSTANCE_FILTER_CHOICES = (

View File

@ -2523,8 +2523,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
nics=nics, nics=nics,
availability_zone=avail_zone.zoneName, availability_zone=avail_zone.zoneName,
instance_count=helpers.IsA(int), instance_count=helpers.IsA(int),
admin_pass=u'', admin_pass='',
disk_config=u'AUTO', disk_config='AUTO',
config_drive=True, config_drive=True,
scheduler_hints=scheduler_hints) scheduler_hints=scheduler_hints)
self.mock_tenant_quota_usages.assert_called_once_with( self.mock_tenant_quota_usages.assert_called_once_with(
@ -2556,13 +2556,13 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
volume_choice = "%s:vol" % volume.id volume_choice = "%s:vol" % volume.id
volume_source_id = volume.id.split(':')[0] volume_source_id = volume.id.split(':')[0]
block_device_mapping = None block_device_mapping = None
block_device_mapping_2 = [ block_device_mapping_2 = [
{'device_name': u'vda', {'device_name': 'vda',
'source_type': 'volume', 'source_type': 'volume',
'destination_type': 'volume', 'destination_type': 'volume',
'delete_on_termination': False, 'delete_on_termination': False,
@ -2634,8 +2634,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
nics=nics, nics=nics,
availability_zone=avail_zone.zoneName, availability_zone=avail_zone.zoneName,
instance_count=helpers.IsA(int), instance_count=helpers.IsA(int),
admin_pass=u'', admin_pass='',
disk_config=u'AUTO', disk_config='AUTO',
config_drive=True, config_drive=True,
scheduler_hints={}) scheduler_hints={})
self.mock_tenant_quota_usages.assert_called_once_with( self.mock_tenant_quota_usages.assert_called_once_with(
@ -2667,7 +2667,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
volume_choice = "%s:vol" % volume.id volume_choice = "%s:vol" % volume.id
block_device_mapping = [ block_device_mapping = [
{'device_name': device_name, {'device_name': device_name,
@ -2749,7 +2749,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
nics=nics, nics=nics,
availability_zone=avail_zone.zoneName, availability_zone=avail_zone.zoneName,
instance_count=helpers.IsA(int), instance_count=helpers.IsA(int),
admin_pass=u'', admin_pass='',
disk_config='MANUAL', disk_config='MANUAL',
config_drive=True, config_drive=True,
scheduler_hints={}) scheduler_hints={})
@ -2856,13 +2856,13 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
snapshot_choice = "%s:snap" % snapshot.id snapshot_choice = "%s:snap" % snapshot.id
snapshot_source_id = snapshot.id.split(':')[0] snapshot_source_id = snapshot.id.split(':')[0]
block_device_mapping = None block_device_mapping = None
block_device_mapping_2 = [ block_device_mapping_2 = [
{'device_name': u'vda', {'device_name': 'vda',
'source_type': 'snapshot', 'source_type': 'snapshot',
'destination_type': 'volume', 'destination_type': 'volume',
'delete_on_termination': 0, 'delete_on_termination': 0,
@ -2936,8 +2936,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
nics=nics, nics=nics,
availability_zone=avail_zone.zoneName, availability_zone=avail_zone.zoneName,
instance_count=helpers.IsA(int), instance_count=helpers.IsA(int),
admin_pass=u'', admin_pass='',
disk_config=u'AUTO', disk_config='AUTO',
config_drive=True, config_drive=True,
scheduler_hints={}) scheduler_hints={})
self.mock_tenant_quota_usages.assert_called_once_with( self.mock_tenant_quota_usages.assert_called_once_with(
@ -3208,7 +3208,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
volume_choice = "%s:vol" % volume.id volume_choice = "%s:vol" % volume.id
quota_usages = self.quota_usages.first() quota_usages = self.quota_usages.first()
@ -3287,7 +3287,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
volume_choice = "%s:vol" % volume.id volume_choice = "%s:vol" % volume.id
quota_usages = self.quota_usages.first() quota_usages = self.quota_usages.first()
if resource == 'both': if resource == 'both':
@ -3386,7 +3386,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
volume_choice = "%s:vol" % volume.id volume_choice = "%s:vol" % volume.id
quota_usages = self.quota_usages.first() quota_usages = self.quota_usages.first()
@ -3630,7 +3630,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': True},) OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': True},)
def test_launch_form_instance_device_name_showed(self): def test_launch_form_instance_device_name_showed(self):
self._test_launch_form_instance_show_device_name( self._test_launch_form_instance_show_device_name(
u'vda', widgets.TextInput, { 'vda', widgets.TextInput, {
'name': 'device_name', 'value': 'vda', 'name': 'device_name', 'value': 'vda',
'attrs': {'id': 'id_device_name'}} 'attrs': {'id': 'id_device_name'}}
) )
@ -3639,7 +3639,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': False}) OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': False})
def test_launch_form_instance_device_name_hidden(self): def test_launch_form_instance_device_name_hidden(self):
self._test_launch_form_instance_show_device_name( self._test_launch_form_instance_show_device_name(
u'', widgets.HiddenInput, { '', widgets.HiddenInput, {
'name': 'device_name', 'value': '', 'name': 'device_name', 'value': '',
'attrs': {'id': 'id_device_name'}} 'attrs': {'id': 'id_device_name'}}
) )
@ -3664,7 +3664,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
sec_group = self.security_groups.first() sec_group = self.security_groups.first()
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
device_name = u'vda' device_name = 'vda'
quota_usages = self.quota_usages.first() quota_usages = self.quota_usages.first()
quota_usages['cores']['available'] = 2000 quota_usages['cores']['available'] = 2000
if avail_volumes is not None: if avail_volumes is not None:
@ -3906,7 +3906,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
avail_zone = self.availability_zones.first() avail_zone = self.availability_zones.first()
customization_script = 'user data' customization_script = 'user data'
nics = [{'net-id': self.networks.first().id, 'v4-fixed-ip': ''}] nics = [{'net-id': self.networks.first().id, 'v4-fixed-ip': ''}]
device_name = u'' device_name = ''
quota_usages = self.quota_usages.first() quota_usages = self.quota_usages.first()
quota_usages['cores']['available'] = 2000 quota_usages['cores']['available'] = 2000
device_mapping_v2 = [{'device_name': None, # device_name must be None device_mapping_v2 = [{'device_name': None, # device_name must be None
@ -3980,9 +3980,9 @@ class InstanceLaunchInstanceTests(InstanceTestBase,
nics=nics, nics=nics,
availability_zone=avail_zone.zoneName, availability_zone=avail_zone.zoneName,
instance_count=helpers.IsA(int), instance_count=helpers.IsA(int),
admin_pass=u'', admin_pass='',
config_drive=False, config_drive=False,
disk_config=u'', disk_config='',
scheduler_hints={}) scheduler_hints={})
@ -4261,7 +4261,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
self.mock_server_group_list.return_value = self.server_groups.list() self.mock_server_group_list.return_value = self.server_groups.list()
self.mock_server_resize.return_value = [] self.mock_server_resize.return_value = []
res = self._instance_resize_post(server.id, flavor.id, u'AUTO') res = self._instance_resize_post(server.id, flavor.id, 'AUTO')
self.assertNoFormErrors(res) self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, INDEX_URL) self.assertRedirectsNoFollow(res, INDEX_URL)
@ -4352,7 +4352,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
def test_rebuild_instance_post_with_password(self): def test_rebuild_instance_post_with_password(self):
server = self.servers.first() server = self.servers.first()
image = self.images.first() image = self.images.first()
password = u'testpass' password = 'testpass'
self.mock_server_get.return_value = server self.mock_server_get.return_value = server
self._mock_glance_image_list_detailed(self.images.list()) self._mock_glance_image_list_detailed(self.images.list())
@ -4406,8 +4406,8 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
def test_rebuild_instance_post_password_do_not_match(self): def test_rebuild_instance_post_password_do_not_match(self):
server = self.servers.first() server = self.servers.first()
image = self.images.first() image = self.images.first()
pass1 = u'somepass' pass1 = 'somepass'
pass2 = u'notsomepass' pass2 = 'notsomepass'
self.mock_server_get.return_value = server self.mock_server_get.return_value = server
self._mock_glance_image_list_detailed(self.images.list()) self._mock_glance_image_list_detailed(self.images.list())
@ -4439,9 +4439,9 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
self.mock_is_feature_available.return_value = False self.mock_is_feature_available.return_value = False
res = self._instance_rebuild_post(server.id, image.id, res = self._instance_rebuild_post(server.id, image.id,
password=u'', password='',
confirm_password=u'', confirm_password='',
disk_config=u'AUTO') disk_config='AUTO')
self.assertNoFormErrors(res) self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, INDEX_URL) self.assertRedirectsNoFollow(res, INDEX_URL)
@ -4489,7 +4489,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
def test_rebuild_instance_post_api_exception(self): def test_rebuild_instance_post_api_exception(self):
server = self.servers.first() server = self.servers.first()
image = self.images.first() image = self.images.first()
password = u'testpass' password = 'testpass'
self.mock_server_get.return_value = server self.mock_server_get.return_value = server
self._mock_glance_image_list_detailed(self.images.list()) self._mock_glance_image_list_detailed(self.images.list())
@ -4711,7 +4711,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin):
def test_rescue_instance_post(self): def test_rescue_instance_post(self):
server = self.servers.first() server = self.servers.first()
image = self.images.first() image = self.images.first()
password = u'testpass' password = 'testpass'
self._mock_glance_image_list_detailed(self.images.list()) self._mock_glance_image_list_detailed(self.images.list())
self.mock_server_rescue.return_value = [] self.mock_server_rescue.return_value = []
res = self._server_rescue_post(server.id, image.id, res = self._server_rescue_post(server.id, image.id,
@ -4839,10 +4839,10 @@ class InstanceAjaxTests(helpers.TestCase):
messages = json.loads(res['X-Horizon-Messages']) messages = json.loads(res['X-Horizon-Messages'])
self.assertEqual(len(messages), 1) self.assertEqual(len(messages), 1)
# (Pdb) messages # (Pdb) messages
# [[u'error', u'Failed to launch instance "server_1": \ # [['error', 'Failed to launch instance "server_1": \
# There is not enough capacity for this flavor in the \ # There is not enough capacity for this flavor in the \
# selected availability zone. Try again later or select \ # selected availability zone. Try again later or select \
# a different availability zone.', u'']] # a different availability zone.', '']]
self.assertEqual(messages[0][0], 'error') self.assertEqual(messages[0][0], 'error')
self.assertTrue(messages[0][1].startswith('Failed')) self.assertTrue(messages[0][1].startswith('Failed'))

View File

@ -34,16 +34,16 @@ class DeleteKeyPairs(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Key Pair", "Delete Key Pair",
u"Delete Key Pairs", "Delete Key Pairs",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Key Pair", "Deleted Key Pair",
u"Deleted Key Pairs", "Deleted Key Pairs",
count count
) )

View File

@ -56,16 +56,16 @@ class DeleteAllowedAddressPair(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete", "Delete",
u"Delete", "Delete",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted address pair", "Deleted address pair",
u"Deleted address pairs", "Deleted address pairs",
count count
) )

View File

@ -61,15 +61,15 @@ class UpdatePort(policy.PolicyTargetMixin, tables.LinkAction):
DISPLAY_CHOICES = ( DISPLAY_CHOICES = (
("UP", pgettext_lazy("Admin state of a Port", u"UP")), ("UP", pgettext_lazy("Admin state of a Port", "UP")),
("DOWN", pgettext_lazy("Admin state of a Port", u"DOWN")), ("DOWN", pgettext_lazy("Admin state of a Port", "DOWN")),
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("ACTIVE", pgettext_lazy("status of a network port", u"Active")), ("ACTIVE", pgettext_lazy("status of a network port", "Active")),
("DOWN", pgettext_lazy("status of a network port", u"Down")), ("DOWN", pgettext_lazy("status of a network port", "Down")),
("ERROR", pgettext_lazy("status of a network port", u"Error")), ("ERROR", pgettext_lazy("status of a network port", "Error")),
("BUILD", pgettext_lazy("status of a network port", u"Build")), ("BUILD", pgettext_lazy("status of a network port", "Build")),
) )
@ -107,16 +107,16 @@ class DeletePort(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Port", "Delete Port",
u"Delete Ports", "Delete Ports",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Port", "Deleted Port",
u"Deleted Ports", "Deleted Ports",
count count
) )

View File

@ -60,16 +60,16 @@ class DeleteSubnet(SubnetPolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Subnet", "Delete Subnet",
u"Delete Subnets", "Delete Subnets",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Subnet", "Deleted Subnet",
u"Deleted Subnets", "Deleted Subnets",
count count
) )

View File

@ -39,16 +39,16 @@ class DeleteNetwork(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Network", "Delete Network",
u"Delete Networks", "Delete Networks",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Network", "Deleted Network",
u"Deleted Networks", "Deleted Networks",
count count
) )
@ -157,14 +157,14 @@ def get_network_link(network):
DISPLAY_CHOICES = ( DISPLAY_CHOICES = (
("up", pgettext_lazy("Admin state of a Network", u"UP")), ("up", pgettext_lazy("Admin state of a Network", "UP")),
("down", pgettext_lazy("Admin state of a Network", u"DOWN")), ("down", pgettext_lazy("Admin state of a Network", "DOWN")),
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("Current status of a Network", u"Active")), ("active", pgettext_lazy("Current status of a Network", "Active")),
("build", pgettext_lazy("Current status of a Network", u"Build")), ("build", pgettext_lazy("Current status of a Network", "Build")),
("down", pgettext_lazy("Current status of a Network", u"Down")), ("down", pgettext_lazy("Current status of a Network", "Down")),
("error", pgettext_lazy("Current status of a Network", u"Error")), ("error", pgettext_lazy("Current status of a Network", "Error")),
) )

View File

@ -40,16 +40,16 @@ class RemoveRouterRoute(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Static Route", "Delete Static Route",
u"Delete Static Routes", "Delete Static Routes",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Static Route", "Deleted Static Route",
u"Deleted Static Routes", "Deleted Static Routes",
count count
) )
failure_url = 'horizon:project:routers:detail' failure_url = 'horizon:project:routers:detail'

View File

@ -53,16 +53,16 @@ class RemoveInterface(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Interface", "Delete Interface",
u"Delete Interfaces", "Delete Interfaces",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Interface", "Deleted Interface",
u"Deleted Interfaces", "Deleted Interfaces",
count count
) )
@ -95,15 +95,15 @@ class RemoveInterface(policy.PolicyTargetMixin, tables.DeleteAction):
DISPLAY_CHOICES = ( DISPLAY_CHOICES = (
("UP", pgettext_lazy("Admin state of a Port", u"UP")), ("UP", pgettext_lazy("Admin state of a Port", "UP")),
("DOWN", pgettext_lazy("Admin state of a Port", u"DOWN")), ("DOWN", pgettext_lazy("Admin state of a Port", "DOWN")),
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("ACTIVE", pgettext_lazy("current status of port", u"Active")), ("ACTIVE", pgettext_lazy("current status of port", "Active")),
("BUILD", pgettext_lazy("current status of port", u"Build")), ("BUILD", pgettext_lazy("current status of port", "Build")),
("DOWN", pgettext_lazy("current status of port", u"Down")), ("DOWN", pgettext_lazy("current status of port", "Down")),
("ERROR", pgettext_lazy("current status of port", u"Error")), ("ERROR", pgettext_lazy("current status of port", "Error")),
("N/A", pgettext_lazy("current status of port", u"N/A")), ("N/A", pgettext_lazy("current status of port", "N/A")),
) )

View File

@ -37,16 +37,16 @@ class DeleteRouter(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Router", "Delete Router",
u"Delete Routers", "Delete Routers",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Router", "Deleted Router",
u"Deleted Routers", "Deleted Routers",
count count
) )
@ -128,16 +128,16 @@ class ClearGateway(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Clear Gateway", "Clear Gateway",
u"Clear Gateways", "Clear Gateways",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Cleared Gateway", "Cleared Gateway",
u"Cleared Gateways", "Cleared Gateways",
count count
) )
@ -202,12 +202,12 @@ class RoutersFilterAction(tables.FilterAction):
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("current status of router", u"Active")), ("active", pgettext_lazy("current status of router", "Active")),
("error", pgettext_lazy("current status of router", u"Error")), ("error", pgettext_lazy("current status of router", "Error")),
) )
ADMIN_STATE_DISPLAY_CHOICES = ( ADMIN_STATE_DISPLAY_CHOICES = (
("up", pgettext_lazy("Admin state of a Router", u"UP")), ("up", pgettext_lazy("Admin state of a Router", "UP")),
("down", pgettext_lazy("Admin state of a Router", u"DOWN")), ("down", pgettext_lazy("Admin state of a Router", "DOWN")),
) )

View File

@ -98,7 +98,7 @@ class IndexView(tables.DataTableView):
# Translators: The usage is "<UUID of ext_net> (Not Found)" # Translators: The usage is "<UUID of ext_net> (Not Found)"
gateway_info['network'] = pgettext_lazy( gateway_info['network'] = pgettext_lazy(
'External network not found', 'External network not found',
u'%s (Not Found)') % ext_net_id '%s (Not Found)') % ext_net_id
class DetailView(tabs.TabbedTableView): class DetailView(tabs.TabbedTableView):

View File

@ -36,16 +36,16 @@ class DeleteGroup(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Security Group", "Delete Security Group",
u"Delete Security Groups", "Delete Security Groups",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Security Group", "Deleted Security Group",
u"Deleted Security Groups", "Deleted Security Groups",
count count
) )
@ -152,16 +152,16 @@ class DeleteRule(tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Rule", "Delete Rule",
u"Delete Rules", "Delete Rules",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Deleted Rule", "Deleted Rule",
u"Deleted Rules", "Deleted Rules",
count count
) )
@ -195,7 +195,7 @@ def get_port_range(rule):
ip_proto = rule.ip_protocol ip_proto = rule.ip_protocol
if rule.from_port == rule.to_port: if rule.from_port == rule.to_port:
return check_rule_template(rule.from_port, ip_proto) return check_rule_template(rule.from_port, ip_proto)
return (u"%(from)s - %(to)s" % return ("%(from)s - %(to)s" %
{'from': check_rule_template(rule.from_port, ip_proto), {'from': check_rule_template(rule.from_port, ip_proto),
'to': check_rule_template(rule.to_port, ip_proto)}) 'to': check_rule_template(rule.to_port, ip_proto)})
@ -221,7 +221,7 @@ def check_rule_template(port, ip_proto):
str(port) == rule['to_port'] and str(port) == rule['to_port'] and
ip_proto == rule['ip_protocol'])] ip_proto == rule['ip_protocol'])]
if templ_rule: if templ_rule:
return u"%(from_port)s (%(name)s)" % templ_rule[0] return "%(from_port)s (%(name)s)" % templ_rule[0]
return port return port

View File

@ -189,7 +189,7 @@ class SecurityGroupsViewTests(test.TestCase):
kwargs.get('from_port', int(rule.from_port)), kwargs.get('from_port', int(rule.from_port)),
kwargs.get('to_port', int(rule.to_port)), kwargs.get('to_port', int(rule.to_port)),
kwargs.get('cidr', rule.ip_range['cidr']), kwargs.get('cidr', rule.ip_range['cidr']),
kwargs.get('security_group', u'%s' % sec_group.id), kwargs.get('security_group', '%s' % sec_group.id),
**extra_params) **extra_params)
self.mock_security_group_list.assert_called_once_with( self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())
@ -510,7 +510,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port), int(rule.from_port),
int(rule.to_port), int(rule.to_port),
None, None,
u'%s' % sec_group.id, '%s' % sec_group.id,
description='') description='')
self.mock_security_group_list.assert_called_once_with( self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())
@ -549,7 +549,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port), int(rule.from_port),
int(rule.to_port), int(rule.to_port),
None, None,
u'%s' % sec_group.id, '%s' % sec_group.id,
description='') description='')
self.mock_security_group_list.assert_called_once_with( self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())
@ -971,7 +971,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port), int(rule.from_port),
int(rule.to_port), int(rule.to_port),
None, None,
u'%s' % sec_group.id, '%s' % sec_group.id,
description='') description='')
self.mock_security_group_list.assert_called_once_with( self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest()) test.IsHttpRequest())

View File

@ -76,16 +76,16 @@ class DeleteVolumeSnapshot(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Volume Snapshot", "Delete Volume Snapshot",
u"Delete Volume Snapshots", "Delete Volume Snapshots",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of Volume Snapshot", "Scheduled deletion of Volume Snapshot",
u"Scheduled deletion of Volume Snapshots", "Scheduled deletion of Volume Snapshots",
count count
) )

View File

@ -37,16 +37,16 @@ class DeleteGroupSnapshot(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Snapshot", "Delete Snapshot",
u"Delete Snapshots", "Delete Snapshots",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of Snapshot", "Scheduled deletion of Snapshot",
u"Scheduled deletion of Snapshots", "Scheduled deletion of Snapshots",
count count
) )
@ -99,13 +99,13 @@ class GroupSnapshotsTable(tables.DataTable):
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("available", ("available",
pgettext_lazy("Current status of Volume Group Snapshot", pgettext_lazy("Current status of Volume Group Snapshot",
u"Available")), "Available")),
("in-use", ("in-use",
pgettext_lazy("Current status of Volume Group Snapshot", pgettext_lazy("Current status of Volume Group Snapshot",
u"In-use")), "In-use")),
("error", ("error",
pgettext_lazy("Current status of Volume Group Snapshot", pgettext_lazy("Current status of Volume Group Snapshot",
u"Error")), "Error")),
) )
name = tables.Column("name_or_id", name = tables.Column("name_or_id",

View File

@ -139,15 +139,15 @@ class GroupsTable(tables.DataTable):
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("available", ("available",
pgettext_lazy("Current status of Volume Group", u"Available")), pgettext_lazy("Current status of Volume Group", "Available")),
("in-use", ("in-use",
pgettext_lazy("Current status of Volume Group", u"In-use")), pgettext_lazy("Current status of Volume Group", "In-use")),
("error", ("error",
pgettext_lazy("Current status of Volume Group", u"Error")), pgettext_lazy("Current status of Volume Group", "Error")),
("updating", ("updating",
pgettext_lazy("Current status of Volume Group", u"Updating")), pgettext_lazy("Current status of Volume Group", "Updating")),
("deleting", ("deleting",
pgettext_lazy("Current status of Volume Group", u"Deleting")), pgettext_lazy("Current status of Volume Group", "Deleting")),
) )
name = tables.WrappingColumn("name_or_id", name = tables.WrappingColumn("name_or_id",

View File

@ -706,7 +706,7 @@ class UploadToImageForm(forms.SelfHandlingForm):
required=False) required=False)
force = forms.BooleanField( force = forms.BooleanField(
label=pgettext_lazy("Force upload volume in in-use status to image", label=pgettext_lazy("Force upload volume in in-use status to image",
u"Force"), "Force"),
widget=forms.CheckboxInput(), widget=forms.CheckboxInput(),
required=False) required=False)

View File

@ -98,16 +98,16 @@ class DeleteVolume(VolumePolicyTargetMixin, tables.DeleteAction):
@staticmethod @staticmethod
def action_present(count): def action_present(count):
return ungettext_lazy( return ungettext_lazy(
u"Delete Volume", "Delete Volume",
u"Delete Volumes", "Delete Volumes",
count count
) )
@staticmethod @staticmethod
def action_past(count): def action_past(count):
return ungettext_lazy( return ungettext_lazy(
u"Scheduled deletion of Volume", "Scheduled deletion of Volume",
u"Scheduled deletion of Volumes", "Scheduled deletion of Volumes",
count count
) )
@ -467,35 +467,35 @@ class VolumesTableBase(tables.DataTable):
) )
STATUS_DISPLAY_CHOICES = ( STATUS_DISPLAY_CHOICES = (
("available", pgettext_lazy("Current status of a Volume", ("available", pgettext_lazy("Current status of a Volume",
u"Available")), "Available")),
("in-use", pgettext_lazy("Current status of a Volume", u"In-use")), ("in-use", pgettext_lazy("Current status of a Volume", "In-use")),
("error", pgettext_lazy("Current status of a Volume", u"Error")), ("error", pgettext_lazy("Current status of a Volume", "Error")),
("creating", pgettext_lazy("Current status of a Volume", ("creating", pgettext_lazy("Current status of a Volume",
u"Creating")), "Creating")),
("error_extending", pgettext_lazy("Current status of a Volume", ("error_extending", pgettext_lazy("Current status of a Volume",
u"Error Extending")), "Error Extending")),
("extending", pgettext_lazy("Current status of a Volume", ("extending", pgettext_lazy("Current status of a Volume",
u"Extending")), "Extending")),
("attaching", pgettext_lazy("Current status of a Volume", ("attaching", pgettext_lazy("Current status of a Volume",
u"Attaching")), "Attaching")),
("detaching", pgettext_lazy("Current status of a Volume", ("detaching", pgettext_lazy("Current status of a Volume",
u"Detaching")), "Detaching")),
("deleting", pgettext_lazy("Current status of a Volume", ("deleting", pgettext_lazy("Current status of a Volume",
u"Deleting")), "Deleting")),
("error_deleting", pgettext_lazy("Current status of a Volume", ("error_deleting", pgettext_lazy("Current status of a Volume",
u"Error deleting")), "Error deleting")),
("backing-up", pgettext_lazy("Current status of a Volume", ("backing-up", pgettext_lazy("Current status of a Volume",
u"Backing Up")), "Backing Up")),
("restoring-backup", pgettext_lazy("Current status of a Volume", ("restoring-backup", pgettext_lazy("Current status of a Volume",
u"Restoring Backup")), "Restoring Backup")),
("error_restoring", pgettext_lazy("Current status of a Volume", ("error_restoring", pgettext_lazy("Current status of a Volume",
u"Error Restoring")), "Error Restoring")),
("maintenance", pgettext_lazy("Current status of a Volume", ("maintenance", pgettext_lazy("Current status of a Volume",
u"Maintenance")), "Maintenance")),
("reserved", pgettext_lazy("Current status of a Volume", ("reserved", pgettext_lazy("Current status of a Volume",
u"Reserved")), "Reserved")),
("awaiting-transfer", pgettext_lazy("Current status of a Volume", ("awaiting-transfer", pgettext_lazy("Current status of a Volume",
u"Awaiting Transfer")), "Awaiting Transfer")),
) )
name = tables.Column("name", name = tables.Column("name",
verbose_name=_("Name"), verbose_name=_("Name"),
@ -598,8 +598,8 @@ class DetachVolume(tables.BatchAction):
def action_present(count): def action_present(count):
return npgettext_lazy( return npgettext_lazy(
"Action to perform (the volume is currently attached)", "Action to perform (the volume is currently attached)",
u"Detach Volume", "Detach Volume",
u"Detach Volumes", "Detach Volumes",
count count
) )
@ -608,8 +608,8 @@ class DetachVolume(tables.BatchAction):
def action_past(count): def action_past(count):
return npgettext_lazy( return npgettext_lazy(
"Past action (the volume is currently being detached)", "Past action (the volume is currently being detached)",
u"Detaching Volume", "Detaching Volume",
u"Detaching Volumes", "Detaching Volumes",
count count
) )

View File

@ -229,9 +229,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
az = self.cinder_availability_zones.first().zoneName az = self.cinder_availability_zones.first().zoneName
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'type': volume_type.name, 'type': volume_type.name,
'size': 50, 'size': 50,
'snapshot_source': '', 'snapshot_source': '',
@ -299,8 +299,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
az = self.cinder_availability_zones.first().zoneName az = self.cinder_availability_zones.first().zoneName
formData = {'name': '', formData = {'name': '',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'type': volume_type.name, 'type': volume_type.name,
'size': 50, 'size': 50,
'snapshot_source': '', 'snapshot_source': '',
@ -362,9 +362,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
}) })
def test_create_volume_dropdown(self): def test_create_volume_dropdown(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 50, 'size': 50,
'type': '', 'type': '',
'volume_source_type': 'no_source_type', 'volume_source_type': 'no_source_type',
@ -428,9 +428,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_snapshot(self): def test_create_volume_from_snapshot(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
snapshot = self.cinder_volume_snapshots.first() snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 50, 'size': 50,
'type': '', 'type': '',
'snapshot_source': snapshot.id} 'snapshot_source': snapshot.id}
@ -486,9 +486,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_volume(self): def test_create_volume_from_volume(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
formData = {'name': u'A copy of a volume', formData = {'name': 'A copy of a volume',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 50, 'size': 50,
'type': '', 'type': '',
'volume_source_type': 'volume_source', 'volume_source_type': 'volume_source',
@ -559,9 +559,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_snapshot_dropdown(self): def test_create_volume_from_snapshot_dropdown(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
snapshot = self.cinder_volume_snapshots.first() snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 50, 'size': 50,
'type': '', 'type': '',
'volume_source_type': 'snapshot_source', 'volume_source_type': 'snapshot_source',
@ -625,9 +625,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
}) })
def test_create_volume_from_snapshot_invalid_size(self): def test_create_volume_from_snapshot_invalid_size(self):
snapshot = self.cinder_volume_snapshots.first() snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 20, 'snapshot_source': snapshot.id} 'size': 20, 'snapshot_source': snapshot.id}
self.mock_volume_type_list.return_value = \ self.mock_volume_type_list.return_value = \
@ -670,9 +670,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_image(self): def test_create_volume_from_image(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
image = self.images.first() image = self.images.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 40, 'size': 40,
'type': '', 'type': '',
'image_source': image.id} 'image_source': image.id}
@ -730,9 +730,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_image_dropdown(self): def test_create_volume_from_image_dropdown(self):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
image = self.images.first() image = self.images.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 30, 'size': 30,
'type': '', 'type': '',
'volume_source_type': 'image_source', 'volume_source_type': 'image_source',
@ -798,9 +798,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
}) })
def test_create_volume_from_image_under_image_size(self): def test_create_volume_from_image_under_image_size(self):
image = self.images.first() image = self.images.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 1, 'image_source': image.id} 'size': 1, 'image_source': image.id}
self.mock_volume_type_list.return_value = \ self.mock_volume_type_list.return_value = \
@ -819,8 +819,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
formData, follow=True) formData, follow=True)
self.assertEqual(res.redirect_chain, []) self.assertEqual(res.redirect_chain, [])
msg = (u"The volume size cannot be less than the " msg = ("The volume size cannot be less than the "
u"image size (20.0\xa0GB)") "image size (20.0\xa0GB)")
self.assertFormError(res, 'form', None, msg) self.assertFormError(res, 'form', None, msg)
@ -844,9 +844,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
'group_list'], 'group_list'],
}) })
def _test_create_volume_from_image_under_image_min_disk_size(self, image): def _test_create_volume_from_image_under_image_min_disk_size(self, image):
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 5, 'image_source': image.id} 'size': 5, 'image_source': image.id}
self.mock_volume_type_list.return_value = \ self.mock_volume_type_list.return_value = \
@ -900,9 +900,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
'group_list'], 'group_list'],
}) })
def test_create_volume_gb_used_over_alloted_quota(self): def test_create_volume_gb_used_over_alloted_quota(self):
formData = {'name': u'This Volume Is Huge!', formData = {'name': 'This Volume Is Huge!',
'description': u'This is a volume that is just too big!', 'description': 'This is a volume that is just too big!',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 5000} 'size': 5000}
usage_limit = self.cinder_quota_usages.first() usage_limit = self.cinder_quota_usages.first()
@ -929,7 +929,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
url = reverse('horizon:project:volumes:create') url = reverse('horizon:project:volumes:create')
res = self.client.post(url, formData) res = self.client.post(url, formData)
expected_error = [u'A volume of 5000GiB cannot be created as you only' expected_error = ['A volume of 5000GiB cannot be created as you only'
' have 20GiB of your quota available.'] ' have 20GiB of your quota available.']
self.assertEqual(res.context['form'].errors['__all__'], expected_error) self.assertEqual(res.context['form'].errors['__all__'], expected_error)
@ -960,9 +960,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
'group_list'], 'group_list'],
}) })
def test_create_volume_number_over_alloted_quota(self): def test_create_volume_number_over_alloted_quota(self):
formData = {'name': u'Too Many...', formData = {'name': 'Too Many...',
'description': u'We have no volumes left!', 'description': 'We have no volumes left!',
'method': u'CreateForm', 'method': 'CreateForm',
'size': 10} 'size': 10}
usage_limit = self.cinder_quota_usages.first() usage_limit = self.cinder_quota_usages.first()
@ -990,7 +990,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
url = reverse('horizon:project:volumes:create') url = reverse('horizon:project:volumes:create')
res = self.client.post(url, formData) res = self.client.post(url, formData)
expected_error = [u'You are already using all of your available' expected_error = ['You are already using all of your available'
' volumes.'] ' volumes.']
self.assertEqual(res.context['form'].errors['__all__'], expected_error) self.assertEqual(res.context['form'].errors['__all__'], expected_error)
@ -1022,9 +1022,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volume_type = self.cinder_volume_types.first() volume_type = self.cinder_volume_types.first()
az = self.cinder_availability_zones.first().zoneName az = self.cinder_availability_zones.first().zoneName
volume_group = self.cinder_groups.list()[0] volume_group = self.cinder_groups.list()[0]
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'description': u'This is a volume I am making for a test.', 'description': 'This is a volume I am making for a test.',
'method': u'CreateForm', 'method': 'CreateForm',
'type': volume_type.name, 'type': volume_type.name,
'size': 50, 'size': 50,
'snapshot_source': '', 'snapshot_source': '',
@ -1736,7 +1736,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
@mock.patch.object(cinder, 'volume_get') @mock.patch.object(cinder, 'volume_get')
def test_extend_volume(self, mock_get, mock_extend, mock_quotas): def test_extend_volume(self, mock_get, mock_extend, mock_quotas):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'orig_size': volume.size, 'orig_size': volume.size,
'new_size': 120} 'new_size': 120}
@ -1760,7 +1760,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
@mock.patch.object(cinder, 'volume_get') @mock.patch.object(cinder, 'volume_get')
def test_extend_volume_with_wrong_size(self, mock_get, mock_quotas): def test_extend_volume_with_wrong_size(self, mock_get, mock_quotas):
volume = self.cinder_volumes.first() volume = self.cinder_volumes.first()
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'orig_size': volume.size, 'orig_size': volume.size,
'new_size': 10} 'new_size': 10}
@ -1895,7 +1895,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
usage_limit.tally('gigabytes', 20) usage_limit.tally('gigabytes', 20)
usage_limit.tally('volumes', len(self.cinder_volumes.list())) usage_limit.tally('volumes', len(self.cinder_volumes.list()))
formData = {'name': u'A Volume I Am Making', formData = {'name': 'A Volume I Am Making',
'orig_size': volume.size, 'orig_size': volume.size,
'new_size': 1000} 'new_size': 1000}
@ -1957,7 +1957,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volumes = self.cinder_volumes.list() volumes = self.cinder_volumes.list()
volToTransfer = [v for v in volumes if v.status == 'available'][0] volToTransfer = [v for v in volumes if v.status == 'available'][0]
formData = {'volume_id': volToTransfer.id, formData = {'volume_id': volToTransfer.id,
'name': u'any transfer name'} 'name': 'any transfer name'}
transfer = self.cinder_volume_transfers.first() transfer = self.cinder_volume_transfers.first()
mock_transfer_create.return_value = transfer mock_transfer_create.return_value = transfer

View File

@ -7612,7 +7612,7 @@ msgid "up"
msgstr "up" msgstr "up"
msgid "vCPUs =" msgid "vCPUs ="
msgstr "vCPU'lar =" msgstr "vCP'lar ="
msgid "yes" msgid "yes"
msgstr "evet" msgstr "evet"

View File

@ -33,12 +33,12 @@ MODULES = ['openstack_dashboard', 'horizon']
def translate(segment): def translate(segment):
prefix = u"" prefix = ""
# When the id starts with a newline the mo compiler enforces that # When the id starts with a newline the mo compiler enforces that
# the translated message must also start with a newline. Make # the translated message must also start with a newline. Make
# sure that doesn't get broken when prepending the bracket. # sure that doesn't get broken when prepending the bracket.
if segment.startswith('\n'): if segment.startswith('\n'):
prefix = u"\n" prefix = "\n"
orig_size = len(segment) orig_size = len(segment)
# Add extra expansion space based on recommendation from # Add extra expansion space based on recommendation from
# http://www-01.ibm.com/software/globalization/guidelines/a3.html # http://www-01.ibm.com/software/globalization/guidelines/a3.html
@ -54,7 +54,7 @@ def translate(segment):
multiplier = 0.3 multiplier = 0.3
extra_length = int(max(0, (orig_size * multiplier) - 10)) extra_length = int(max(0, (orig_size * multiplier) - 10))
extra_chars = "~" * extra_length extra_chars = "~" * extra_length
return u"{0}[~{1}~您好яшçあ{2}]".format(prefix, segment, extra_chars) return "{0}[~{1}~您好яшçあ{2}]".format(prefix, segment, extra_chars)
class Command(BaseCommand): class Command(BaseCommand):
@ -121,7 +121,7 @@ class Command(BaseCommand):
for msg in pot_cat: for msg in pot_cat:
if msg.pluralizable: if msg.pluralizable:
msg.string = [ msg.string = [
translate(u"{}:{}".format(i, msg.id[0])) translate("{}:{}".format(i, msg.id[0]))
for i in range(num_plurals)] for i in range(num_plurals)]
else: else:
msg.string = translate(msg.id) msg.string = translate(msg.id)

View File

@ -156,7 +156,7 @@ def check_invalid_settings(dummy=None):
if invalid: if invalid:
return upgradecheck.Result( return upgradecheck.Result(
upgradecheck.Code.WARNING, upgradecheck.Code.WARNING,
_("Unknown settings: {}.").format(u", ".join(invalid)), _("Unknown settings: {}.").format(", ".join(invalid)),
) )
return upgradecheck.Result(upgradecheck.Code.SUCCESS) return upgradecheck.Result(upgradecheck.Code.SUCCESS)
@ -173,7 +173,7 @@ def check_deprecated_settings(dummy=None):
if deprecated: if deprecated:
return upgradecheck.Result( return upgradecheck.Result(
upgradecheck.Code.FAILURE, upgradecheck.Code.FAILURE,
_("Deprecated settings: {}.").format(u", ".join(deprecated)), _("Deprecated settings: {}.").format(", ".join(deprecated)),
) )
return upgradecheck.Result(upgradecheck.Code.SUCCESS) return upgradecheck.Result(upgradecheck.Code.SUCCESS)
@ -193,7 +193,7 @@ def check_required_settings(dummy=None):
if missing: if missing:
return upgradecheck.Result( return upgradecheck.Result(
upgradecheck.Code.FAILURE, upgradecheck.Code.FAILURE,
_("Missing required settings: {}.").format(u", ".join(missing)), _("Missing required settings: {}.").format(", ".join(missing)),
) )
return upgradecheck.Result(upgradecheck.Code.SUCCESS) return upgradecheck.Result(upgradecheck.Code.SUCCESS)

View File

@ -300,8 +300,8 @@ class TestVolumesActions(helpers.TestCase):
5. Repeat actions for all disk formats 5. Repeat actions for all disk formats
""" """
self.volumes_page = self.home_pg.go_to_project_volumes_volumespage() self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()
all_formats = {"qcow2": u'QCOW2', "raw": u'Raw', "vdi": u'VDI', all_formats = {"qcow2": 'QCOW2', "raw": 'Raw', "vdi": 'VDI',
"vmdk": u'VMDK'} "vmdk": 'VMDK'}
for disk_format in all_formats: for disk_format in all_formats:
self.volumes_page.upload_volume_to_image(self.VOLUME_NAME, self.volumes_page.upload_volume_to_image(self.VOLUME_NAME,
self.IMAGE_NAME, self.IMAGE_NAME,

View File

@ -115,7 +115,7 @@ def data(TEST):
{'id': "21023e92-8008-1234-8059-7f2293ff3889", {'id': "21023e92-8008-1234-8059-7f2293ff3889",
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'name': u'my_volume', 'name': 'my_volume',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': None, 'volume_type': None,
@ -129,7 +129,7 @@ def data(TEST):
'name': 'my_volume2', 'name': 'my_volume2',
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'name': u'my_volume2', 'name': 'my_volume2',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': 'vol_type_2', 'volume_type': 'vol_type_2',
@ -142,7 +142,7 @@ def data(TEST):
{'id': "21023e92-8008-1234-8059-7f2293ff3890", {'id': "21023e92-8008-1234-8059-7f2293ff3890",
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
'name': u'my_volume', 'name': 'my_volume',
'display_description': '', 'display_description': '',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'volume_type': None, 'volume_type': None,
@ -164,26 +164,26 @@ def data(TEST):
vol_type1 = volume_types.VolumeType( vol_type1 = volume_types.VolumeType(
volume_types.VolumeTypeManager(None), volume_types.VolumeTypeManager(None),
{'id': u'1', {'id': '1',
'name': u'vol_type_1', 'name': 'vol_type_1',
'description': 'type 1 description', 'description': 'type 1 description',
'extra_specs': {'foo': 'bar', 'extra_specs': {'foo': 'bar',
'volume_backend_name': 'backend_1'}}) 'volume_backend_name': 'backend_1'}})
vol_type2 = volume_types.VolumeType( vol_type2 = volume_types.VolumeType(
volume_types.VolumeTypeManager(None), volume_types.VolumeTypeManager(None),
{'id': u'2', {'id': '2',
'name': u'vol_type_2', 'name': 'vol_type_2',
'description': 'type 2 description'}) 'description': 'type 2 description'})
vol_type3 = volume_types.VolumeType( vol_type3 = volume_types.VolumeType(
volume_types.VolumeTypeManager(None), volume_types.VolumeTypeManager(None),
{'id': u'3', {'id': '3',
'name': u'vol_type_3', 'name': 'vol_type_3',
'is_public': False, 'is_public': False,
'description': 'type 3 description'}) 'description': 'type 3 description'})
TEST.cinder_volume_types.add(vol_type1, vol_type2, vol_type3) TEST.cinder_volume_types.add(vol_type1, vol_type2, vol_type3)
vol_type_access1 = volume_type_access.VolumeTypeAccess( vol_type_access1 = volume_type_access.VolumeTypeAccess(
volume_type_access.VolumeTypeAccessManager(None), volume_type_access.VolumeTypeAccessManager(None),
{'volume_type_id': u'1', 'project_id': u'1'}) {'volume_type_id': '1', 'project_id': '1'})
TEST.cinder_type_access.add(vol_type_access1) TEST.cinder_type_access.add(vol_type_access1)
# Volumes - Cinder v2 # Volumes - Cinder v2
@ -253,14 +253,14 @@ def data(TEST):
# Volume Type Encryption # Volume Type Encryption
vol_enc_type1 = vol_enc_types.VolumeEncryptionType( vol_enc_type1 = vol_enc_types.VolumeEncryptionType(
vol_enc_types.VolumeEncryptionTypeManager(None), vol_enc_types.VolumeEncryptionTypeManager(None),
{'volume_type_id': u'1', {'volume_type_id': '1',
'control_location': "front-end", 'control_location': "front-end",
'key_size': 512, 'key_size': 512,
'provider': "a-provider", 'provider': "a-provider",
'cipher': "a-cipher"}) 'cipher': "a-cipher"})
vol_enc_type2 = vol_enc_types.VolumeEncryptionType( vol_enc_type2 = vol_enc_types.VolumeEncryptionType(
vol_enc_types.VolumeEncryptionTypeManager(None), vol_enc_types.VolumeEncryptionTypeManager(None),
{'volume_type_id': u'2', {'volume_type_id': '2',
'control_location': "front-end", 'control_location': "front-end",
'key_size': 256, 'key_size': 256,
'provider': "a-provider", 'provider': "a-provider",

View File

@ -57,32 +57,32 @@ def data(TEST):
TEST.snapshotsV2 = utils.TestDataContainer() TEST.snapshotsV2 = utils.TestDataContainer()
# Snapshots # Snapshots
snapshot_dict = {'name': u'snapshot', snapshot_dict = {'name': 'snapshot',
'container_format': u'ami', 'container_format': 'ami',
'id': 3, 'id': 3,
'status': "active", 'status': "active",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot_dict_no_owner = {'name': u'snapshot 2', snapshot_dict_no_owner = {'name': 'snapshot 2',
'container_format': u'ami', 'container_format': 'ami',
'id': 4, 'id': 4,
'status': "active", 'status': "active",
'owner': None, 'owner': None,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot_dict_queued = {'name': u'snapshot 2', snapshot_dict_queued = {'name': 'snapshot 2',
'container_format': u'ami', 'container_format': 'ami',
'id': 5, 'id': 5,
'status': "queued", 'status': "queued",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'properties': {'image_type': u'snapshot'}, 'properties': {'image_type': 'snapshot'},
'is_public': False, 'is_public': False,
'protected': False} 'protected': False}
snapshot_dict_with_volume = {'name': u'snapshot 2', snapshot_dict_with_volume = {'name': 'snapshot 2',
'container_format': u'ami', 'container_format': 'ami',
'id': 6, 'id': 6,
'status': "queued", 'status': "queued",
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
@ -104,14 +104,14 @@ def data(TEST):
# Images # Images
image_dict = {'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', image_dict = {'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822',
'name': 'public_image', 'name': 'public_image',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'status': "active", 'status': "active",
'size': 20 * 1024 ** 3, 'size': 20 * 1024 ** 3,
'virtual_size': None, 'virtual_size': None,
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': False, 'protected': False,
'min_ram': 0, 'min_ram': 0,
@ -140,7 +140,7 @@ def data(TEST):
'virtual_size': None, 'virtual_size': None,
'min_disk': 30, 'min_disk': 30,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': True, 'protected': True,
'min_ram': 0, 'min_ram': 0,
@ -155,7 +155,7 @@ def data(TEST):
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'image_type': u'image'}, 'properties': {'image_type': 'image'},
'is_public': True, 'is_public': True,
'protected': False, 'protected': False,
'min_ram': 0} 'min_ram': 0}
@ -240,9 +240,9 @@ def data(TEST):
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'container_format': 'novaImage', 'container_format': 'novaImage',
'properties': {'description': u'a multi prop image', 'properties': {'description': 'a multi prop image',
'foo': u'foo val', 'foo': 'foo val',
'bar': u'bar val'}, 'bar': 'bar val'},
'is_public': True, 'is_public': True,
'protected': False} 'protected': False}
multi_prop_image = APIResourceV2(image_dict) multi_prop_image = APIResourceV2(image_dict)
@ -283,7 +283,7 @@ def data(TEST):
'created_at': '2014-02-14T20:56:53', 'created_at': '2014-02-14T20:56:53',
'direct_url': 'swift+config://ref1/glance/' 'direct_url': 'swift+config://ref1/glance/'
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5', 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5',
'disk_format': u'qcow2', 'disk_format': 'qcow2',
'file': '/v2/images/' 'file': '/v2/images/'
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5/file', 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5/file',
'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822', 'id': '007e7d55-fe1e-4c5c-bf08-44b4a4964822',
@ -294,7 +294,7 @@ def data(TEST):
'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5'}], 'da8500d5-8b80-4b9c-8410-cc57fb8fb9d5'}],
'min_ram': 0, 'min_ram': 0,
'name': 'public_image', 'name': 'public_image',
'image_type': u'image', 'image_type': 'image',
'min_disk': 0, 'min_disk': 0,
'owner': TEST.tenant.id, 'owner': TEST.tenant.id,
'protected': False, 'protected': False,
@ -310,7 +310,7 @@ def data(TEST):
'container_format': 'novaImage', 'container_format': 'novaImage',
'created_at': '2014-03-16T06:22:14', 'created_at': '2014-03-16T06:22:14',
'disk_format': None, 'disk_format': None,
'image_type': u'image', 'image_type': 'image',
'file': '/v2/images/885d1cb0-9f5c-4677-9d03-175be7f9f984/file', 'file': '/v2/images/885d1cb0-9f5c-4677-9d03-175be7f9f984/file',
'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c', 'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c',
'locations': [], 'locations': [],
@ -344,9 +344,9 @@ def data(TEST):
'updated_at': '2015-09-02T00:31:17Z', 'updated_at': '2015-09-02T00:31:17Z',
'virtual_size': None, 'virtual_size': None,
'visibility': 'public', 'visibility': 'public',
'description': u'a multi prop image', 'description': 'a multi prop image',
'foo': u'foo val', 'foo': 'foo val',
'bar': u'bar val' 'bar': 'bar val'
}] }]
for fixture in image_v2_dicts: for fixture in image_v2_dicts:
apiresource = APIResourceV2(fixture) apiresource = APIResourceV2(fixture)

View File

@ -405,7 +405,7 @@ def data(TEST):
'domain_id': '2', 'domain_id': '2',
'domain_name': 'disabled_domain'} 'domain_name': 'disabled_domain'}
tenant_dict_3 = {'id': "3", tenant_dict_3 = {'id': "3",
'name': u'\u4e91\u89c4\u5219', 'name': '\u4e91\u89c4\u5219',
'description': "an unicode-named tenant.", 'description': "an unicode-named tenant.",
'enabled': True, 'enabled': True,
'domain_id': '2', 'domain_id': '2',

View File

@ -506,7 +506,7 @@ def data(TEST):
def add_rule_to_group(secgroup, default_only=True): def add_rule_to_group(secgroup, default_only=True):
rule_egress_ipv4 = { rule_egress_ipv4 = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'egress', 'ethertype': u'IPv4', 'direction': 'egress', 'ethertype': 'IPv4',
'port_range_min': None, 'port_range_max': None, 'port_range_min': None, 'port_range_max': None,
'protocol': None, 'remote_group_id': None, 'protocol': None, 'remote_group_id': None,
'remote_ip_prefix': None, 'remote_ip_prefix': None,
@ -516,7 +516,7 @@ def data(TEST):
} }
rule_egress_ipv6 = { rule_egress_ipv6 = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'egress', 'ethertype': u'IPv6', 'direction': 'egress', 'ethertype': 'IPv6',
'port_range_min': None, 'port_range_max': None, 'port_range_min': None, 'port_range_max': None,
'protocol': None, 'remote_group_id': None, 'protocol': None, 'remote_group_id': None,
'remote_ip_prefix': None, 'remote_ip_prefix': None,
@ -526,29 +526,29 @@ def data(TEST):
} }
rule_tcp_80 = { rule_tcp_80 = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'ingress', 'ethertype': u'IPv4', 'direction': 'ingress', 'ethertype': 'IPv4',
'port_range_min': 80, 'port_range_max': 80, 'port_range_min': 80, 'port_range_max': 80,
'protocol': u'tcp', 'remote_group_id': None, 'protocol': 'tcp', 'remote_group_id': None,
'remote_ip_prefix': u'0.0.0.0/0', 'remote_ip_prefix': '0.0.0.0/0',
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'tenant_id': secgroup['tenant_id'], 'tenant_id': secgroup['tenant_id'],
'description': 'Ingress HTTP', 'description': 'Ingress HTTP',
} }
rule_icmp = { rule_icmp = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'ingress', 'ethertype': u'IPv4', 'direction': 'ingress', 'ethertype': 'IPv4',
'port_range_min': 5, 'port_range_max': 8, 'port_range_min': 5, 'port_range_max': 8,
'protocol': u'icmp', 'remote_group_id': None, 'protocol': 'icmp', 'remote_group_id': None,
'remote_ip_prefix': u'0.0.0.0/0', 'remote_ip_prefix': '0.0.0.0/0',
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'tenant_id': secgroup['tenant_id'], 'tenant_id': secgroup['tenant_id'],
'description': 'Ingress IPv4 ICMP', 'description': 'Ingress IPv4 ICMP',
} }
rule_group = { rule_group = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'ingress', 'ethertype': u'IPv4', 'direction': 'ingress', 'ethertype': 'IPv4',
'port_range_min': 80, 'port_range_max': 80, 'port_range_min': 80, 'port_range_max': 80,
'protocol': u'tcp', 'remote_group_id': sec_group_1['id'], 'protocol': 'tcp', 'remote_group_id': sec_group_1['id'],
'remote_ip_prefix': None, 'remote_ip_prefix': None,
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'tenant_id': secgroup['tenant_id'], 'tenant_id': secgroup['tenant_id'],
@ -556,20 +556,20 @@ def data(TEST):
} }
rule_ip_proto = { rule_ip_proto = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'ingress', 'ethertype': u'IPv4', 'direction': 'ingress', 'ethertype': 'IPv4',
'port_range_min': None, 'port_range_max': None, 'port_range_min': None, 'port_range_max': None,
'protocol': u'99', 'remote_group_id': None, 'protocol': '99', 'remote_group_id': None,
'remote_ip_prefix': u'0.0.0.0/24', 'remote_ip_prefix': '0.0.0.0/24',
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'tenant_id': secgroup['tenant_id'], 'tenant_id': secgroup['tenant_id'],
'description': 'Ingress custom IP protocol 99', 'description': 'Ingress custom IP protocol 99',
} }
rule_all_tcp = { rule_all_tcp = {
'id': uuidutils.generate_uuid(), 'id': uuidutils.generate_uuid(),
'direction': u'egress', 'ethertype': u'IPv4', 'direction': 'egress', 'ethertype': 'IPv4',
'port_range_min': 1, 'port_range_max': 65535, 'port_range_min': 1, 'port_range_max': 65535,
'protocol': u'tcp', 'remote_group_id': None, 'protocol': 'tcp', 'remote_group_id': None,
'remote_ip_prefix': u'0.0.0.0/24', 'remote_ip_prefix': '0.0.0.0/24',
'security_group_id': secgroup['id'], 'security_group_id': secgroup['id'],
'tenant_id': secgroup['tenant_id'], 'tenant_id': secgroup['tenant_id'],
'description': 'Egress all TCP', 'description': 'Egress all TCP',
@ -867,7 +867,7 @@ def data(TEST):
'sub_ports': [{'segmentation_type': 'vlan', 'sub_ports': [{'segmentation_type': 'vlan',
'segmentation_id': tdata['tag_1'], 'segmentation_id': tdata['tag_1'],
'port_id': tdata['child1']['id']}, 'port_id': tdata['child1']['id']},
{'segmentation_type': u'vlan', {'segmentation_type': 'vlan',
'segmentation_id': tdata['tag_2'], 'segmentation_id': tdata['tag_2'],
'port_id': tdata['child2']['id']}], 'port_id': tdata['child2']['id']}],
'name': 'trunk', 'name': 'trunk',

View File

@ -359,7 +359,7 @@ def data(TEST):
"server_id": "2"}) "server_id": "2"})
server_2 = servers.Server(servers.ServerManager(None), server_2 = servers.Server(servers.ServerManager(None),
json.loads(SERVER_DATA % vals)['server']) json.loads(SERVER_DATA % vals)['server'])
vals.update({"name": u'\u4e91\u89c4\u5219', vals.update({"name": '\u4e91\u89c4\u5219',
"status": "ACTIVE", "status": "ACTIVE",
"tenant_id": tenant3.id, "tenant_id": tenant3.id,
"server_id": "3"}) "server_id": "3"})
@ -380,33 +380,33 @@ def data(TEST):
# VNC Console Data # VNC Console Data
console = { console = {
u'console': { 'console': {
u'url': u'http://example.com:6080/vnc_auto.html', 'url': 'http://example.com:6080/vnc_auto.html',
u'type': u'novnc' 'type': 'novnc'
} }
} }
TEST.servers.vnc_console_data = console TEST.servers.vnc_console_data = console
# SPICE Console Data # SPICE Console Data
console = { console = {
u'console': { 'console': {
u'url': u'http://example.com:6080/spice_auto.html', 'url': 'http://example.com:6080/spice_auto.html',
u'type': u'spice' 'type': 'spice'
} }
} }
TEST.servers.spice_console_data = console TEST.servers.spice_console_data = console
# RDP Console Data # RDP Console Data
console = { console = {
u'console': { 'console': {
u'url': u'http://example.com:6080/rdp_auto.html', 'url': 'http://example.com:6080/rdp_auto.html',
u'type': u'rdp' 'type': 'rdp'
} }
} }
TEST.servers.rdp_console_data = console TEST.servers.rdp_console_data = console
# MKS Console Data # MKS Console Data
console = { console = {
u'remote_console': { 'remote_console': {
u'url': u'http://example.com:6080/mks_auto.html', 'url': 'http://example.com:6080/mks_auto.html',
u'type': u'mks' 'type': 'mks'
} }
} }
TEST.servers.mks_console_data = console TEST.servers.mks_console_data = console

View File

@ -30,14 +30,14 @@ def data(TEST):
# ' ' (space) can break 'Content-Disposition' if not properly # ' ' (space) can break 'Content-Disposition' if not properly
# double-quoted # double-quoted
container_dict_1 = {"name": u"container one%\u6346", container_dict_1 = {"name": "container one%\u6346",
"container_object_count": 2, "container_object_count": 2,
"container_bytes_used": 256, "container_bytes_used": 256,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
"is_public": False, "is_public": False,
"public_url": ""} "public_url": ""}
container_1 = swift.Container(container_dict_1) container_1 = swift.Container(container_dict_1)
container_2_name = u"container_two\u6346" container_2_name = "container_two\u6346"
container_dict_2 = {"name": container_2_name, container_dict_2 = {"name": container_2_name,
"container_object_count": 4, "container_object_count": 4,
"container_bytes_used": 1024, "container_bytes_used": 1024,
@ -48,7 +48,7 @@ def data(TEST):
"v1/project_id/%s" % utils_http.urlquote( "v1/project_id/%s" % utils_http.urlquote(
container_2_name)} container_2_name)}
container_2 = swift.Container(container_dict_2) container_2 = swift.Container(container_dict_2)
container_dict_3 = {"name": u"container,three%\u6346", container_dict_3 = {"name": "container,three%\u6346",
"container_object_count": 2, "container_object_count": 2,
"container_bytes_used": 256, "container_bytes_used": 256,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
@ -57,30 +57,30 @@ def data(TEST):
container_3 = swift.Container(container_dict_3) container_3 = swift.Container(container_dict_3)
TEST.containers.add(container_1, container_2, container_3) TEST.containers.add(container_1, container_2, container_3)
object_dict = {"name": u"test object%\u6346", object_dict = {"name": "test object%\u6346",
"content_type": u"text/plain", "content_type": "text/plain",
"bytes": 128, "bytes": 128,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
"last_modified": None, "last_modified": None,
"hash": u"object_hash"} "hash": "object_hash"}
object_dict_2 = {"name": u"test_object_two\u6346", object_dict_2 = {"name": "test_object_two\u6346",
"content_type": u"text/plain", "content_type": "text/plain",
"bytes": 128, "bytes": 128,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
"last_modified": None, "last_modified": None,
"hash": u"object_hash_2"} "hash": "object_hash_2"}
object_dict_3 = {"name": u"test,object_three%\u6346", object_dict_3 = {"name": "test,object_three%\u6346",
"content_type": u"text/plain", "content_type": "text/plain",
"bytes": 128, "bytes": 128,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
"last_modified": None, "last_modified": None,
"hash": u"object_hash"} "hash": "object_hash"}
object_dict_4 = {"name": u"test folder%\u6346/test.txt", object_dict_4 = {"name": "test folder%\u6346/test.txt",
"content_type": u"text/plain", "content_type": "text/plain",
"bytes": 128, "bytes": 128,
"timestamp": timeutils.utcnow().isoformat(), "timestamp": timeutils.utcnow().isoformat(),
"last_modified": None, "last_modified": None,
"hash": u"object_hash"} "hash": "object_hash"}
obj_dicts = [object_dict, object_dict_2, object_dict_3, object_dict_4] obj_dicts = [object_dict, object_dict_2, object_dict_3, object_dict_4]
obj_data = b"Fake Data" obj_data = b"Fake Data"
@ -90,18 +90,18 @@ def data(TEST):
data=obj_data) data=obj_data)
TEST.objects.add(swift_object) TEST.objects.add(swift_object)
folder_dict = {"subdir": u"test folder%\u6346/"} folder_dict = {"subdir": "test folder%\u6346/"}
TEST.folder.add(swift.PseudoFolder(folder_dict, container_1.name)) TEST.folder.add(swift.PseudoFolder(folder_dict, container_1.name))
# when the folder is returned as part of a prefix match, this content # when the folder is returned as part of a prefix match, this content
# is returned by Swift instead: # is returned by Swift instead:
folder_dict_alt = { folder_dict_alt = {
"name": u"test folder%\u6346/", "name": "test folder%\u6346/",
"bytes": 0, "bytes": 0,
"last_modified": timeutils.utcnow().isoformat(), "last_modified": timeutils.utcnow().isoformat(),
"content_type": u"application/octet-stream", "content_type": "application/octet-stream",
"hash": u"object_hash" "hash": "object_hash"
} }
TEST.folder_alt.add(swift.PseudoFolder(folder_dict_alt, container_1.name)) TEST.folder_alt.add(swift.PseudoFolder(folder_dict_alt, container_1.name))

View File

@ -81,7 +81,7 @@ class SwiftRestTestCase(test.TestCase):
False) False)
response = swift.Containers().get(request) response = swift.Containers().get(request)
self.assertStatusCode(response, 200) self.assertStatusCode(response, 200)
self.assertEqual(u'container one%\u6346', self.assertEqual('container one%\u6346',
response.json['items'][0]['name']) response.json['items'][0]['name'])
self.assertFalse(response.json['has_more']) self.assertFalse(response.json['has_more'])
self.mock_swift_get_containers.assert_called_once_with(request) self.mock_swift_get_containers.assert_called_once_with(request)
@ -90,11 +90,11 @@ class SwiftRestTestCase(test.TestCase):
def test_container_get(self): def test_container_get(self):
request = self.mock_rest_request() request = self.mock_rest_request()
self.mock_swift_get_container.return_value = self.containers.first() self.mock_swift_get_container.return_value = self.containers.first()
response = swift.Container().get(request, u'container one%\u6346') response = swift.Container().get(request, 'container one%\u6346')
self.assertStatusCode(response, 200) self.assertStatusCode(response, 200)
self.assertEqual(response.json, self.containers.first().to_dict()) self.assertEqual(response.json, self.containers.first().to_dict())
self.mock_swift_get_container.assert_called_once_with( self.mock_swift_get_container.assert_called_once_with(
request, u'container one%\u6346') request, 'container one%\u6346')
@test.create_mocks({api.swift: ['swift_create_container']}) @test.create_mocks({api.swift: ['swift_create_container']})
def test_container_create(self): def test_container_create(self):
@ -102,7 +102,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request(body='{}') request = self.mock_rest_request(body='{}')
response = swift.Container().post(request, 'spam') response = swift.Container().post(request, 'spam')
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)
self.assertEqual(u'/api/swift/containers/spam', self.assertEqual('/api/swift/containers/spam',
response['location']) response['location'])
self.mock_swift_create_container.assert_called_once_with( self.mock_swift_create_container.assert_called_once_with(
request, 'spam', metadata={} request, 'spam', metadata={}
@ -114,7 +114,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request(body='{"is_public": false}') request = self.mock_rest_request(body='{"is_public": false}')
response = swift.Container().post(request, 'spam') response = swift.Container().post(request, 'spam')
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)
self.assertEqual(u'/api/swift/containers/spam', self.assertEqual('/api/swift/containers/spam',
response['location']) response['location'])
self.mock_swift_create_container.assert_called_once_with( self.mock_swift_create_container.assert_called_once_with(
request, 'spam', metadata={'is_public': False} request, 'spam', metadata={'is_public': False}
@ -124,10 +124,10 @@ class SwiftRestTestCase(test.TestCase):
def test_container_delete(self): def test_container_delete(self):
self.mock_swift_delete_container.return_value = True self.mock_swift_delete_container.return_value = True
request = self.mock_rest_request() request = self.mock_rest_request()
response = swift.Container().delete(request, u'container one%\u6346') response = swift.Container().delete(request, 'container one%\u6346')
self.assertStatusCode(response, 204) self.assertStatusCode(response, 204)
self.mock_swift_delete_container.assert_called_once_with( self.mock_swift_delete_container.assert_called_once_with(
request, u'container one%\u6346' request, 'container one%\u6346'
) )
@test.create_mocks({api.swift: ['swift_update_container']}) @test.create_mocks({api.swift: ['swift_update_container']})
@ -151,42 +151,42 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_get_objects.return_value = ( self.mock_swift_get_objects.return_value = (
self.objects.list() + self.folder.list(), False self.objects.list() + self.folder.list(), False
) )
response = swift.Objects().get(request, u'container one%\u6346') response = swift.Objects().get(request, 'container one%\u6346')
self.assertStatusCode(response, 200) self.assertStatusCode(response, 200)
self.assertEqual(5, len(response.json['items'])) self.assertEqual(5, len(response.json['items']))
self.assertEqual(u'test folder%\u6346/test.txt', self.assertEqual('test folder%\u6346/test.txt',
response.json['items'][3]['path']) response.json['items'][3]['path'])
self.assertEqual('test.txt', response.json['items'][3]['name']) self.assertEqual('test.txt', response.json['items'][3]['name'])
self.assertTrue(response.json['items'][3]['is_object']) self.assertTrue(response.json['items'][3]['is_object'])
self.assertFalse(response.json['items'][3]['is_subdir']) self.assertFalse(response.json['items'][3]['is_subdir'])
self.assertEqual(u'test folder%\u6346/test.txt', self.assertEqual('test folder%\u6346/test.txt',
response.json['items'][3]['path']) response.json['items'][3]['path'])
self.assertEqual(u'test folder%\u6346/', self.assertEqual('test folder%\u6346/',
response.json['items'][4]['path']) response.json['items'][4]['path'])
self.assertEqual(u'test folder%\u6346', self.assertEqual('test folder%\u6346',
response.json['items'][4]['name']) response.json['items'][4]['name'])
self.assertFalse(response.json['items'][4]['is_object']) self.assertFalse(response.json['items'][4]['is_object'])
self.assertTrue(response.json['items'][4]['is_subdir']) self.assertTrue(response.json['items'][4]['is_subdir'])
self.mock_swift_get_objects.assert_called_once_with( self.mock_swift_get_objects.assert_called_once_with(
request, request,
u'container one%\u6346', 'container one%\u6346',
prefix=None) prefix=None)
@test.create_mocks({api.swift: ['swift_get_objects']}) @test.create_mocks({api.swift: ['swift_get_objects']})
def test_container_get_path_folder(self): def test_container_get_path_folder(self):
request = self.mock_rest_request(GET={'path': u'test folder%\u6346/'}) request = self.mock_rest_request(GET={'path': 'test folder%\u6346/'})
self.mock_swift_get_objects.return_value = (self.subfolder.list(), self.mock_swift_get_objects.return_value = (self.subfolder.list(),
False) False)
response = swift.Objects().get(request, u'container one%\u6346') response = swift.Objects().get(request, 'container one%\u6346')
self.assertStatusCode(response, 200) self.assertStatusCode(response, 200)
self.assertEqual(1, len(response.json['items'])) self.assertEqual(1, len(response.json['items']))
self.assertTrue(response.json['items'][0]['is_object']) self.assertTrue(response.json['items'][0]['is_object'])
self.assertFalse(response.json['items'][0]['is_subdir']) self.assertFalse(response.json['items'][0]['is_subdir'])
self.mock_swift_get_objects.assert_called_once_with( self.mock_swift_get_objects.assert_called_once_with(
request, request,
u'container one%\u6346', prefix=u'test folder%\u6346/' 'container one%\u6346', prefix='test folder%\u6346/'
) )
@test.create_mocks({api.swift: ['swift_get_object']}) @test.create_mocks({api.swift: ['swift_get_object']})
@ -219,10 +219,10 @@ class SwiftRestTestCase(test.TestCase):
form_obj = self.mock_UploadObjectForm.return_value form_obj = self.mock_UploadObjectForm.return_value
form_obj.is_valid.return_value = True form_obj.is_valid.return_value = True
# note file name not used, path name is # note file name not used, path name is
_file = mock.Mock(name=u'NOT object%\u6346') _file = mock.Mock(name='NOT object%\u6346')
form_obj.clean.return_value = {'file': _file} form_obj.clean.return_value = {'file': _file}
request = self.mock_rest_request() request = self.mock_rest_request()
real_name = u'test_object%\u6346' real_name = 'test_object%\u6346'
self.mock_swift_upload_object.return_value = self.objects.first() self.mock_swift_upload_object.return_value = self.objects.first()
response = swift.Object().post(request, 'spam', real_name) response = swift.Object().post(request, 'spam', real_name)
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)
@ -232,7 +232,7 @@ class SwiftRestTestCase(test.TestCase):
response['location'] response['location']
) )
self.mock_swift_upload_object.assert_called_once_with( self.mock_swift_upload_object.assert_called_once_with(
request, 'spam', u'test_object%\u6346', _file) request, 'spam', 'test_object%\u6346', _file)
@test.create_mocks({api.swift: ['swift_create_pseudo_folder'], @test.create_mocks({api.swift: ['swift_create_pseudo_folder'],
swift: ['UploadObjectForm']}) swift: ['UploadObjectForm']})
@ -243,7 +243,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request() request = self.mock_rest_request()
self.mock_swift_create_pseudo_folder.return_value = \ self.mock_swift_create_pseudo_folder.return_value = \
self.folder_alt.first() self.folder_alt.first()
response = swift.Object().post(request, 'spam', u'test_folder%\u6346/') response = swift.Object().post(request, 'spam', 'test_folder%\u6346/')
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)
self.assertEqual( self.assertEqual(
response['location'], response['location'],
@ -251,7 +251,7 @@ class SwiftRestTestCase(test.TestCase):
'=25=E6=8D=86/?=' '=25=E6=8D=86/?='
) )
self.mock_swift_create_pseudo_folder.assert_called_once_with( self.mock_swift_create_pseudo_folder.assert_called_once_with(
request, 'spam', u'test_folder%\u6346/') request, 'spam', 'test_folder%\u6346/')
@test.create_mocks({api.swift: ['swift_copy_object']}) @test.create_mocks({api.swift: ['swift_copy_object']})
def test_object_copy(self): def test_object_copy(self):
@ -261,7 +261,7 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_copy_object.return_value = self.objects.first() self.mock_swift_copy_object.return_value = self.objects.first()
response = swift.ObjectCopy().post(request, response = swift.ObjectCopy().post(request,
'spam', 'spam',
u'test object%\u6346') 'test object%\u6346')
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)
self.assertEqual( self.assertEqual(
response['location'], response['location'],
@ -272,7 +272,7 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_copy_object.assert_called_once_with( self.mock_swift_copy_object.assert_called_once_with(
request, request,
'spam', 'spam',
u'test object%\u6346', 'test object%\u6346',
'eggs', 'eggs',
'bacon') 'bacon')
self.assertStatusCode(response, 201) self.assertStatusCode(response, 201)

View File

@ -400,12 +400,12 @@ class GlanceApiTests(test.APIMockTestCase):
def test_create_image_metadata_docker_v2(self): def test_create_image_metadata_docker_v2(self):
form_data = { form_data = {
'name': u'Docker image', 'name': 'Docker image',
'description': u'Docker image test', 'description': 'Docker image test',
'source_type': u'url', 'source_type': 'url',
'image_url': u'/', 'image_url': '/',
'disk_format': u'docker', 'disk_format': 'docker',
'architecture': u'x86-64', 'architecture': 'x86-64',
'min_disk': 15, 'min_disk': 15,
'min_ram': 512, 'min_ram': 512,
'is_public': False, 'is_public': False,
@ -421,12 +421,12 @@ class GlanceApiTests(test.APIMockTestCase):
def test_create_image_metadata_vhd(self): def test_create_image_metadata_vhd(self):
form_data = { form_data = {
'name': u'OVF image', 'name': 'OVF image',
'description': u'OVF image test', 'description': 'OVF image test',
'source_type': u'url', 'source_type': 'url',
'image_url': u'/', 'image_url': '/',
'disk_format': u'vhd', 'disk_format': 'vhd',
'architecture': u'x86-64', 'architecture': 'x86-64',
'min_disk': 15, 'min_disk': 15,
'min_ram': 512, 'min_ram': 512,
'is_public': False, 'is_public': False,

View File

@ -264,7 +264,7 @@ class ComputeApiTests(test.APIMockTestCase):
novaclient.usage.get.assert_has_calls([ novaclient.usage.get.assert_has_calls([
mock.call(self.tenant.id, 'start', 'end'), mock.call(self.tenant.id, 'start', 'end'),
mock.call(self.tenant.id, 'start', 'end', mock.call(self.tenant.id, 'start', 'end',
marker=u'063cf7f3-ded1-4297-bc4c-31eae876cc93'), marker='063cf7f3-ded1-4297-bc4c-31eae876cc93'),
]) ])
@mock.patch.object(api._nova, 'novaclient') @mock.patch.object(api._nova, 'novaclient')
@ -301,7 +301,7 @@ class ComputeApiTests(test.APIMockTestCase):
novaclient.usage.list.assert_has_calls([ novaclient.usage.list.assert_has_calls([
mock.call('start', 'end', True), mock.call('start', 'end', True),
mock.call('start', 'end', True, mock.call('start', 'end', True,
marker=u'063cf7f3-ded1-4297-bc4c-31eae876cc93'), marker='063cf7f3-ded1-4297-bc4c-31eae876cc93'),
]) ])
@mock.patch.object(api._nova, 'novaclient') @mock.patch.object(api._nova, 'novaclient')

View File

@ -22,7 +22,7 @@ class ConfigTypesTest(unittest.TestCase):
self.assertRaises(ValueError, literal, "[1, '2', 3]") self.assertRaises(ValueError, literal, "[1, '2', 3]")
literal = config_types.Literal({0: ""}) literal = config_types.Literal({0: ""})
self.assertEqual({1: 'a', 2: u'b'}, literal("{1: 'a', 2: u'b'}")) self.assertEqual({1: 'a', 2: 'b'}, literal("{1: 'a', 2: 'b'}"))
self.assertRaises(ValueError, literal, "[1, '2', 3]") self.assertRaises(ValueError, literal, "[1, '2', 3]")
self.assertRaises(ValueError, literal, "{1: 1, '2': 2}") self.assertRaises(ValueError, literal, "{1: 1, '2': 2}")

View File

@ -75,7 +75,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
copyright = u'2015, Horizon Developers' copyright = '2015, Horizon Developers'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@ -204,8 +204,8 @@ htmlhelp_basename = 'HorizonReleaseNotesdoc'
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'HorizonReleaseNotes.tex', ('index', 'HorizonReleaseNotes.tex',
u'Horizon Release Notes Documentation', 'Horizon Release Notes Documentation',
u'Horizon Developers', 'manual'), 'Horizon Developers', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -234,8 +234,8 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'horizonreleasenotes', u'Horizon Release Notes Documentation', ('index', 'horizonreleasenotes', 'Horizon Release Notes Documentation',
[u'Horizon Developers'], 1) ['Horizon Developers'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
@ -248,8 +248,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'HorizonReleaseNotes', u'Horizon Release Notes Documentation', ('index', 'HorizonReleaseNotes', 'Horizon Release Notes Documentation',
u'Horizon Developers', 'HorizonReleaseNotes', 'Horizon Developers', 'HorizonReleaseNotes',
'Dashboard for OpenStack.', 'Dashboard for OpenStack.',
'Miscellaneous'), 'Miscellaneous'),
] ]