Reviewed: https://review.opendev.org/c/openstack/horizon/+/851262 Committed: https://opendev.org/openstack/horizon/commit/b893bcdee32a640f148e1682485da849f0058f31 Submitter: "Zuul (22348)" Branch: master
commit b893bcdee32a640f148e1682485da849f0058f31 Author: Akihiro Motoki <[email protected]> Date: Thu Jul 28 04:29:58 2022 +0900 Make site_branding tag work with Django 4.0 A test for site_branding tag starts to fail with Django 4.0. It seems to happen as settings.SITE_BRANDING is _("Horizon") and a translation marker _() is no longer evaluated during rendering. As a solution, this commit changes the implementation of site_branding tag to use "simple_tag" method as django.template.Library.simple_tag() [1] seems to handle an i18n-ed string properly. [1] https://docs.djangoproject.com/en/4.0/howto/custom-template-tags/#simple-tags Closes-Bug: #1980214 Change-Id: I6fdfffbeef2b405da21289d37722e3f068e27fea ** Changed in: horizon Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Dashboard (Horizon). https://bugs.launchpad.net/bugs/1980214 Title: Django4: TemplateTagTests.test_site_branding_tag test failure in Debian unstable Status in OpenStack Dashboard (Horizon): Fix Released Bug description: Hi, Building Horizon (yoga) in Debian Unstable resulted in failure with TemplateTagTests.test_site_branding_tag. Here's the build log: ___________________ TemplateTagTests.test_site_branding_tag ____________________ [gw9] linux -- Python 3.9.13 /usr/bin/python3.9 self = <horizon.test.unit.templatetags.test_templatetags.TemplateTagTests testMethod=test_site_branding_tag> def test_site_branding_tag(self): """Test if site_branding tag renders the correct setting.""" > rendered_str = self.render_template_tag("site_branding", "branding") horizon/test/unit/templatetags/test_templatetags.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ horizon/test/unit/templatetags/test_templatetags.py:47: in render_template_tag return self.render_template(tag_call, tag_require) horizon/test/unit/templatetags/test_templatetags.py:54: in render_template return template.render(Context(context)) /usr/lib/python3/dist-packages/django/template/base.py:175: in render return self._render(context) /usr/lib/python3/dist-packages/django/test/utils.py:111: in instrumented_test_render return self.nodelist.render(context) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = [<django.template.defaulttags.LoadNode object at 0x7efd84ca8d60>, <TextNode: ' '>, <horizon.templatetags.branding.SiteBrandingNode object at 0x7efd84ca82e0>] context = [{'True': True, 'False': False, 'None': None}, {}] def render(self, context): > return SafeString("".join([node.render_annotated(context) for node in self])) E TypeError: sequence item 2: expected str instance, __proxy__ found To manage notifications about this bug go to: https://bugs.launchpad.net/horizon/+bug/1980214/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

