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:
parent
cb7038d07e
commit
87f498bee5
@ -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.
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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® > > here', []),
|
||||
(2, 'gettext', 'To <a href="link">link</a> here', []),
|
||||
(3, 'gettext', 'To <!-- a comment!! --> here', []),
|
||||
(4, 'gettext', 'To trademark® > > here', []),
|
||||
],
|
||||
messages)
|
||||
|
@ -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': ''})
|
||||
|
@ -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)
|
||||
)
|
||||
|
@ -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')
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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't be empty')
|
||||
'The new availability zone can't be empty')
|
||||
|
||||
|
||||
class ManageHostsTests(test.BaseAdminViewTests):
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"),)
|
||||
|
@ -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'))
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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")),
|
||||
)
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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])
|
||||