Accepting request 286497 from home:dstoecker

Fix a major break, which causes problems with Trac. As a 0.7.1. release is not to be expected soon, this backport fixes the issue.

OBS-URL: https://build.opensuse.org/request/show/286497
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Genshi?expand=0&rev=6
This commit is contained in:
Michal Čihař 2015-02-18 12:38:58 +00:00 committed by Git OBS Bridge
parent f632b1073d
commit fa63893b99
3 changed files with 50 additions and 4 deletions

38
changeset_r1242.diff Normal file
View File

@ -0,0 +1,38 @@
Index: /trunk/genshi/filters/tests/i18n.py
===================================================================
--- /trunk/genshi/filters/tests/i18n.py (revision 1177)
+++ /trunk/genshi/filters/tests/i18n.py (revision 1242)
@@ -928,4 +928,16 @@
"""</p></html>""",
tmpl.generate(first="FIRST", second="SECOND").render())
+
+ def test_translate_i18n_msg_ticket_404_regression(self):
+ tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"
+ xmlns:i18n="http://genshi.edgewall.org/i18n">
+ <h1 i18n:msg="name">text <a>$name</a></h1>
+ </html>""")
+ gettext = lambda s: u'head [1:%(name)s] tail'
+ translator = Translator(gettext)
+ translator.setup(tmpl)
+ self.assertEqual("""<html>
+ <h1>head <a>NAME</a> tail</h1>
+ </html>""", tmpl.generate(name='NAME').render())
Index: /trunk/genshi/filters/i18n.py
===================================================================
--- /trunk/genshi/filters/i18n.py (revision 1177)
+++ /trunk/genshi/filters/i18n.py (revision 1242)
@@ -1049,5 +1049,11 @@
while parts:
order, string = parts.pop(0)
- events = self.events[order].pop(0)
+ events = self.events[order]
+ if events:
+ events = events.pop(0)
+ else:
+ # create a dummy empty text event so any remaining
+ # part of the translation can be processed.
+ events = [(TEXT, "", (None, -1, -1))]
parts_counter[order].pop()

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Feb 17 10:53:23 UTC 2015 - opensuse@dstoecker.de
- backport fix for bug 566 (pop from empty) from 0.7 devel (changeset_r1242.diff)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Oct 22 14:31:18 UTC 2013 - toddrme2178@gmail.com Tue Oct 22 14:31:18 UTC 2013 - toddrme2178@gmail.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-Genshi # spec file for package python-Genshi
# #
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -18,19 +18,21 @@
Name: python-Genshi Name: python-Genshi
Version: 0.7 Version: 0.7
Release: 1 Release: 0
Url: http://genshi.edgewall.org/ Url: http://genshi.edgewall.org/
Summary: A toolkit for generation of output for the web Summary: A toolkit for generation of output for the web
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Languages/Python Group: Development/Languages/Python
Source: http://ftp.edgewall.com/pub/genshi/Genshi-%{version}.tar.gz Source: http://ftp.edgewall.com/pub/genshi/Genshi-%{version}.tar.gz
# FIX-UPSTREAM http://genshi.edgewall.org/ticket/566
Patch1: changeset_r1242.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: python-Babel BuildRequires: python-Babel
BuildRequires: python-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: python-xml BuildRequires: python-xml
Requires: python-xml
Requires: python-Babel Requires: python-Babel
Requires: python-xml
Provides: python-genshi = %{version} Provides: python-genshi = %{version}
Obsoletes: python-genshi < %{version} Obsoletes: python-genshi < %{version}
%if 0%{?suse_version} <= 1110 %if 0%{?suse_version} <= 1110
@ -60,6 +62,7 @@ This package contains documentation and examples.
%prep %prep
%setup -q -n Genshi-%{version} %setup -q -n Genshi-%{version}
%patch1 -p2
sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits
%build %build