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

View File

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

View File

@ -243,7 +243,7 @@ class SelectWidget(widgets.Widget):
def render_option(self, selected_choices, option_value, option_label):
option_value = force_text(option_value)
other_html = (u' selected="selected"'
other_html = (' selected="selected"'
if option_value in selected_choices else '')
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)
return u'<option value="%s"%s>%s</option>' % (
return '<option value="%s"%s>%s</option>' % (
html.escape(option_value), other_html, option_label)
def render_options(self, selected_choices):
@ -424,7 +424,7 @@ class ThemableCheckboxInput(widgets.CheckboxInput):
label_for = attrs['id']
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),
label_for
)
@ -538,8 +538,8 @@ class ThemableCheckboxChoiceInput(ChoiceInput):
label_for = ''
attrs = dict(self.attrs, **attrs) if attrs else self.attrs
return html.format_html(
u'<div class="themable-checkbox">{}<label{}>' +
u'<span>{}</span></label></div>',
'<div class="themable-checkbox">{}<label{}>' +
'<span>{}</span></label></div>',
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
if not table._filter_action(self, request, datum):
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(),
'dis': datum_display
})
@ -769,7 +769,7 @@ class BatchAction(Action):
self.update(request, datum)
action_success.append(datum_display)
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),
'datum_display': datum_display})
except Exception as ex:

View File

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

View File

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

View File

@ -46,15 +46,15 @@ class FakeObject(object):
self.extra = "extra"
def __str__(self):
return u"%s: %s" % (self.__class__.__name__, self.name)
return "%s: %s" % (self.__class__.__name__, self.name)
TEST_DATA = (
FakeObject('1', 'object_1', 'value_1', 'up', 'optional_1', 'excluded_1'),
FakeObject('2', 'object_2', '<strong>evil</strong>', 'down', 'optional_2'),
FakeObject('3', 'object_3', 'value_3', 'up'),
FakeObject('4', u'öbject_4', u'välue_1', u'üp', u'öptional_1',
u'exclüded_1'),
FakeObject('4', 'öbject_4', 'välue_1', 'üp', 'öptional_1',
'exclüded_1'),
)
TEST_DATA_2 = (
@ -158,8 +158,8 @@ class MyBatchAction(tables.BatchAction):
def action_present(count):
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Batch Item",
u"Batch Items",
"Batch Item",
"Batch Items",
count
)
@ -167,8 +167,8 @@ class MyBatchAction(tables.BatchAction):
def action_past(count):
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Batched Item",
u"Batched Items",
"Batched Item",
"Batched Items",
count
)
@ -180,12 +180,12 @@ class MyBatchActionWithHelpText(MyBatchAction):
@staticmethod
def action_present(count):
# No translation
return u"BatchHelp Item"
return "BatchHelp Item"
@staticmethod
def action_past(count):
# No translation
return u"BatchedHelp Item"
return "BatchedHelp Item"
class MyToggleAction(tables.BatchAction):
@ -195,15 +195,15 @@ class MyToggleAction(tables.BatchAction):
if self.current_present_action:
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Up Item",
u"Up Items",
"Up Item",
"Up Items",
count
)
else:
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Down Item",
u"Down Items",
"Down Item",
"Down Items",
count
)
@ -211,15 +211,15 @@ class MyToggleAction(tables.BatchAction):
if self.current_past_action:
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Upped Item",
u"Upped Items",
"Upped Item",
"Upped Items",
count
)
else:
# Translators: test code, don't really have to translate
return ungettext_lazy(
u"Downed Item",
u"Downed Items",
"Downed Item",
"Downed Items",
count
)
@ -419,7 +419,7 @@ class DataTableTests(test.TestCase):
self.assertTrue(self.table._meta.actions_column)
self.assertTrue(self.table._meta.multi_select)
# Test for verbose_name
self.assertEqual(u"My Table", str(self.table))
self.assertEqual("My Table", str(self.table))
# Column ordering and exclusion.
# This should include auto-columns for multi_select and actions,
# but should not contain the excluded column.
@ -666,7 +666,7 @@ class DataTableTests(test.TestCase):
row = self.table.get_rows()[0]
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)
def test_table_rendering(self):
@ -830,7 +830,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1',
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
'FakeObject: öbject_4'],
transform=str)
# with unknown value it should return empty list
@ -913,7 +913,7 @@ class DataTableTests(test.TestCase):
handled = self.table.maybe_handle()
self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Downed Item: object_1",
self.assertEqual("Downed Item: object_1",
list(req._messages)[0].message)
# Toggle from status 'down' to 'up'
@ -933,7 +933,7 @@ class DataTableTests(test.TestCase):
handled = self.table.maybe_handle()
self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Upped Item: object_2",
self.assertEqual("Upped Item: object_2",
list(req._messages)[0].message)
# there are underscore in object-id.
@ -1014,7 +1014,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1',
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
'FakeObject: öbject_4'],
transform=str)
# Updating and preemptive actions
@ -1074,7 +1074,7 @@ class DataTableTests(test.TestCase):
['FakeObject: object_1',
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
'FakeObject: öbject_4'],
transform=str)
def test_column_uniqueness(self):
@ -1166,8 +1166,7 @@ class DataTableTests(test.TestCase):
self.assertEqual(302, handled.status_code)
self.assertEqual("/my_url/", handled["location"])
self.assertEqual(u"Downed Item: 1",
list(req._messages)[0].message)
self.assertEqual("Downed Item: 1", list(req._messages)[0].message)
mock_get_object_display.assert_called_once_with(
test.IsA(FakeObject))
@ -1368,7 +1367,7 @@ class DataTableViewTests(test.TestCase):
['FakeObject: object_1',
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
'FakeObject: öbject_4'],
transform=str)
self.assertEqual(req.session.get(self.fil_value_param), 'up')
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_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
'FakeObject: öbject_4'],
transform=str)
context = tab.get_context_data(self.request)
# 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',
'5555|mb_float_format', '80|mb_float_format',
'.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 = ''
for size_filter in size_str:
@ -76,7 +76,7 @@ class TemplateTagTests(test.TestCase):
def test_size_format_filters_with_string(self):
size_str = ('"test"|diskgbformat', '"limit"|mb_float_format',
'"no limit"|mbformat')
expected = u' test limit no limit '
expected = ' test limit no limit '
text = ''
for size_filter in size_str:
@ -94,7 +94,7 @@ class TemplateTagTests(test.TestCase):
text = ('{{ test.val1|truncate:1 }}#{{ test.val2|truncate:4 }}#'
'{{ test.val3|truncate:10 }}')
expected = u' h#h...#four'
expected = ' h#h...#four'
rendered_str = self.render_template(tag_require='truncate_filter',
template_text=text,
context={'test': ctx_string})
@ -108,7 +108,7 @@ class TemplateTagTests(test.TestCase):
text = ('{{ test.val1|quota:"TB" }}#{{ test.val2|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',
template_text=text,

View File

@ -18,10 +18,10 @@ from horizon.test import helpers as test
class HandleTests(test.TestCase):
def test_handle_translated(self):
translated_unicode = u'\u30b3\u30f3\u30c6\u30ca\u30fc\u304c' \
u'\u7a7a\u3067\u306f\u306a\u3044\u305f' \
u'\u3081\u3001\u524a\u9664\u3067\u304d' \
u'\u307e\u305b\u3093\u3002'
translated_unicode = '\u30b3\u30f3\u30c6\u30ca\u30fc\u304c' \
'\u7a7a\u3067\u306f\u306a\u3044\u305f' \
'\u3081\u3001\u524a\u9664\u3067\u304d' \
'\u307e\u305b\u3093\u3002'
# Japanese translation of:
# '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
# like a recoverable exception
message = u"Couldn't make the thing"
exc_msg = u"Exception string"
message = "Couldn't make the thing"
exc_msg = "Exception string"
req = self.request
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])
def test_handle_exception_with_empty_details(self):
message = u"Couldn't make the thing"
message = "Couldn't make the thing"
details = ""
expected = ['error', message, '']
req = self.request
@ -78,8 +78,8 @@ class HandleTests(test.TestCase):
self.assertCountEqual(req.horizon['async_messages'], [expected])
def test_handle_exception_with_details(self):
message = u"Couldn't make the thing"
exc_msg = u"Exception string"
message = "Couldn't make the thing"
exc_msg = "Exception string"
details = "custom detail message"
expected = ['error', message + exceptions.SEPERATOR + details, '']
req = self.request

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ DEFAULT_QUOTA_NAME = 'default'
CONSUMER_CHOICES = (
('back-end', _('back-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')

View File

@ -252,7 +252,7 @@ class SecurityGroupRule(NeutronAPIDictWrapper):
def _get_secgroup_name(self, sg_id, sg_dict):
if not sg_id:
return u''
return ''
if sg_dict is None:
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
messages.error(request, error_message)
raise
return {u'OS-EXT-IPS-MAC:mac_addr': mac,
u'version': version,
u'addr': ip,
u'OS-EXT-IPS:type': type}
return {'OS-EXT-IPS-MAC:mac_addr': mac,
'version': version,
'addr': ip,
'OS-EXT-IPS:type': type}
addresses = collections.defaultdict(list)
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(
_format_address(port.mac_address,
fixed_ip['ip_address'],
u'fixed'))
'fixed'))
else:
addresses[network_name] = []
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(
_format_address(port.mac_address,
fip.floating_ip_address,
u'floating'))
'floating'))
return dict(addresses)

View File

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

View File

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

View File

@ -104,7 +104,7 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
workflow_data['name'] = ''
workflow_data['availability_zone'] = ''
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):
aggregate = self.aggregates.first()
@ -115,14 +115,14 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests):
self._test_generic_create_aggregate(workflow_data, aggregate,
existing_aggregates, 1,
u'This field is required')
'This field is required')
def test_create_aggregate_fails_duplicated_name(self):
aggregate = self.aggregates.first()
existing_aggregates = self.aggregates.list()
workflow_data = self._get_create_workflow_data(aggregate)
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)
self._test_generic_create_aggregate(workflow_data, aggregate,
@ -254,7 +254,7 @@ class AggregatesViewTests(test.BaseAdminViewTests):
'availability_zone': aggregate.availability_zone}
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):
aggregate = self.aggregates.first()
@ -264,7 +264,7 @@ class AggregatesViewTests(test.BaseAdminViewTests):
self._test_generic_update_aggregate(
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):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -78,7 +78,7 @@ class UsageViewTests(test.BaseAdminViewTests):
self.assertEqual(nova_stu_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">
<td class="sortable normal_column">test_tenant</td>
<td class="sortable normal_column">%s</td>
@ -97,7 +97,7 @@ class UsageViewTests(test.BaseAdminViewTests):
)
# 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">
<td class="sortable normal_column">3 (Deleted)</td>
<td class="sortable normal_column">%s</td>
@ -168,7 +168,7 @@ class UsageViewTests(test.BaseAdminViewTests):
if nova_stu_enabled:
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.vcpus,
obj.memory_mb,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,13 +76,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction):
def action_present(count):
return (
ungettext_lazy(
u"Enable User",
u"Enable Users",
"Enable User",
"Enable Users",
count
),
ungettext_lazy(
u"Disable User",
u"Disable Users",
"Disable User",
"Disable Users",
count
),
)
@ -91,13 +91,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction):
def action_past(count):
return (
ungettext_lazy(
u"Enabled User",
u"Enabled Users",
"Enabled User",
"Enabled Users",
count
),
ungettext_lazy(
u"Disabled User",
u"Disabled Users",
"Disabled User",
"Disabled Users",
count
),
)
@ -134,16 +134,16 @@ class DeleteUsersAction(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete User",
u"Delete Users",
"Delete User",
"Delete Users",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted User",
u"Deleted Users",
"Deleted User",
"Deleted Users",
count
)
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)
self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to disable user: '
u'test_user')
'You are not allowed to disable user: '
'test_user')
self.assert_mock_multiple_calls_with_same_arguments(
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)
self.assertEqual(list(res.context['messages'])[0].message,
u'You are not allowed to disable user: '
u'test_user')
'You are not allowed to disable user: '
'test_user')
self.assert_mock_multiple_calls_with_same_arguments(
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)
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.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)
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.assert_mock_multiple_calls_with_same_arguments(

View File

@ -132,7 +132,7 @@ class ASCIITenantNameRCTests(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):
super()._setup_user(tenant_name=self.TENANT_NAME)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,16 +37,16 @@ class DeleteRouter(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Router",
u"Delete Routers",
"Delete Router",
"Delete Routers",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Router",
u"Deleted Routers",
"Deleted Router",
"Deleted Routers",
count
)
@ -128,16 +128,16 @@ class ClearGateway(policy.PolicyTargetMixin, tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Clear Gateway",
u"Clear Gateways",
"Clear Gateway",
"Clear Gateways",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Cleared Gateway",
u"Cleared Gateways",
"Cleared Gateway",
"Cleared Gateways",
count
)
@ -202,12 +202,12 @@ class RoutersFilterAction(tables.FilterAction):
STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("current status of router", u"Active")),
("error", pgettext_lazy("current status of router", u"Error")),
("active", pgettext_lazy("current status of router", "Active")),
("error", pgettext_lazy("current status of router", "Error")),
)
ADMIN_STATE_DISPLAY_CHOICES = (
("up", pgettext_lazy("Admin state of a Router", u"UP")),
("down", pgettext_lazy("Admin state of a Router", u"DOWN")),
("up", pgettext_lazy("Admin state of a Router", "UP")),
("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)"
gateway_info['network'] = pgettext_lazy(
'External network not found',
u'%s (Not Found)') % ext_net_id
'%s (Not Found)') % ext_net_id
class DetailView(tabs.TabbedTableView):

View File

@ -36,16 +36,16 @@ class DeleteGroup(policy.PolicyTargetMixin, tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Security Group",
u"Delete Security Groups",
"Delete Security Group",
"Delete Security Groups",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Security Group",
u"Deleted Security Groups",
"Deleted Security Group",
"Deleted Security Groups",
count
)
@ -152,16 +152,16 @@ class DeleteRule(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Rule",
u"Delete Rules",
"Delete Rule",
"Delete Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Deleted Rule",
u"Deleted Rules",
"Deleted Rule",
"Deleted Rules",
count
)
@ -195,7 +195,7 @@ def get_port_range(rule):
ip_proto = rule.ip_protocol
if rule.from_port == rule.to_port:
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),
'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
ip_proto == rule['ip_protocol'])]
if templ_rule:
return u"%(from_port)s (%(name)s)" % templ_rule[0]
return "%(from_port)s (%(name)s)" % templ_rule[0]
return port

View File

@ -189,7 +189,7 @@ class SecurityGroupsViewTests(test.TestCase):
kwargs.get('from_port', int(rule.from_port)),
kwargs.get('to_port', int(rule.to_port)),
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)
self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest())
@ -510,7 +510,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port),
int(rule.to_port),
None,
u'%s' % sec_group.id,
'%s' % sec_group.id,
description='')
self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest())
@ -549,7 +549,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port),
int(rule.to_port),
None,
u'%s' % sec_group.id,
'%s' % sec_group.id,
description='')
self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest())
@ -971,7 +971,7 @@ class SecurityGroupsViewTests(test.TestCase):
int(rule.from_port),
int(rule.to_port),
None,
u'%s' % sec_group.id,
'%s' % sec_group.id,
description='')
self.mock_security_group_list.assert_called_once_with(
test.IsHttpRequest())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -81,7 +81,7 @@ class SwiftRestTestCase(test.TestCase):
False)
response = swift.Containers().get(request)
self.assertStatusCode(response, 200)
self.assertEqual(u'container one%\u6346',
self.assertEqual('container one%\u6346',
response.json['items'][0]['name'])
self.assertFalse(response.json['has_more'])
self.mock_swift_get_containers.assert_called_once_with(request)
@ -90,11 +90,11 @@ class SwiftRestTestCase(test.TestCase):
def test_container_get(self):
request = self.mock_rest_request()
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.assertEqual(response.json, self.containers.first().to_dict())
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']})
def test_container_create(self):
@ -102,7 +102,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request(body='{}')
response = swift.Container().post(request, 'spam')
self.assertStatusCode(response, 201)
self.assertEqual(u'/api/swift/containers/spam',
self.assertEqual('/api/swift/containers/spam',
response['location'])
self.mock_swift_create_container.assert_called_once_with(
request, 'spam', metadata={}
@ -114,7 +114,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request(body='{"is_public": false}')
response = swift.Container().post(request, 'spam')
self.assertStatusCode(response, 201)
self.assertEqual(u'/api/swift/containers/spam',
self.assertEqual('/api/swift/containers/spam',
response['location'])
self.mock_swift_create_container.assert_called_once_with(
request, 'spam', metadata={'is_public': False}
@ -124,10 +124,10 @@ class SwiftRestTestCase(test.TestCase):
def test_container_delete(self):
self.mock_swift_delete_container.return_value = True
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.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']})
@ -151,42 +151,42 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_get_objects.return_value = (
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.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'])
self.assertEqual('test.txt', response.json['items'][3]['name'])
self.assertTrue(response.json['items'][3]['is_object'])
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'])
self.assertEqual(u'test folder%\u6346/',
self.assertEqual('test folder%\u6346/',
response.json['items'][4]['path'])
self.assertEqual(u'test folder%\u6346',
self.assertEqual('test folder%\u6346',
response.json['items'][4]['name'])
self.assertFalse(response.json['items'][4]['is_object'])
self.assertTrue(response.json['items'][4]['is_subdir'])
self.mock_swift_get_objects.assert_called_once_with(
request,
u'container one%\u6346',
'container one%\u6346',
prefix=None)
@test.create_mocks({api.swift: ['swift_get_objects']})
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(),
False)
response = swift.Objects().get(request, u'container one%\u6346')
response = swift.Objects().get(request, 'container one%\u6346')
self.assertStatusCode(response, 200)
self.assertEqual(1, len(response.json['items']))
self.assertTrue(response.json['items'][0]['is_object'])
self.assertFalse(response.json['items'][0]['is_subdir'])
self.mock_swift_get_objects.assert_called_once_with(
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']})
@ -219,10 +219,10 @@ class SwiftRestTestCase(test.TestCase):
form_obj = self.mock_UploadObjectForm.return_value
form_obj.is_valid.return_value = True
# 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}
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()
response = swift.Object().post(request, 'spam', real_name)
self.assertStatusCode(response, 201)
@ -232,7 +232,7 @@ class SwiftRestTestCase(test.TestCase):
response['location']
)
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'],
swift: ['UploadObjectForm']})
@ -243,7 +243,7 @@ class SwiftRestTestCase(test.TestCase):
request = self.mock_rest_request()
self.mock_swift_create_pseudo_folder.return_value = \
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.assertEqual(
response['location'],
@ -251,7 +251,7 @@ class SwiftRestTestCase(test.TestCase):
'=25=E6=8D=86/?='
)
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']})
def test_object_copy(self):
@ -261,7 +261,7 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_copy_object.return_value = self.objects.first()
response = swift.ObjectCopy().post(request,
'spam',
u'test object%\u6346')
'test object%\u6346')
self.assertStatusCode(response, 201)
self.assertEqual(
response['location'],
@ -272,7 +272,7 @@ class SwiftRestTestCase(test.TestCase):
self.mock_swift_copy_object.assert_called_once_with(
request,
'spam',
u'test object%\u6346',
'test object%\u6346',
'eggs',
'bacon')
self.assertStatusCode(response, 201)

View File

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

View File

@ -264,7 +264,7 @@ class ComputeApiTests(test.APIMockTestCase):
novaclient.usage.get.assert_has_calls([
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')
@ -301,7 +301,7 @@ class ComputeApiTests(test.APIMockTestCase):
novaclient.usage.list.assert_has_calls([
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')

View File

@ -22,7 +22,7 @@ class ConfigTypesTest(unittest.TestCase):
self.assertRaises(ValueError, literal, "[1, '2', 3]")
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: 1, '2': 2}")

View File

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