From fa63893b997abf76c4d7e58d2abe5d3789b9a9c35b764d438b47af8c84631b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 18 Feb 2015 12:38:58 +0000 Subject: [PATCH] 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 --- changeset_r1242.diff | 38 ++++++++++++++++++++++++++++++++++++++ python-Genshi.changes | 5 +++++ python-Genshi.spec | 11 +++++++---- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 changeset_r1242.diff diff --git a/changeset_r1242.diff b/changeset_r1242.diff new file mode 100644 index 0000000..00b7e6b --- /dev/null +++ b/changeset_r1242.diff @@ -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 @@ + """

""", + tmpl.generate(first="FIRST", second="SECOND").render()) ++ ++ def test_translate_i18n_msg_ticket_404_regression(self): ++ tmpl = MarkupTemplate(""" ++

text $name

++ """) ++ gettext = lambda s: u'head [1:%(name)s] tail' ++ translator = Translator(gettext) ++ translator.setup(tmpl) ++ self.assertEqual(""" ++

head NAME tail

++ """, 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() + diff --git a/python-Genshi.changes b/python-Genshi.changes index 3c011a4..c2ac0b9 100644 --- a/python-Genshi.changes +++ b/python-Genshi.changes @@ -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 diff --git a/python-Genshi.spec b/python-Genshi.spec index b1ee9fc..dbae433 100644 --- a/python-Genshi.spec +++ b/python-Genshi.spec @@ -1,7 +1,7 @@ # # 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 # remain the property of their copyright owners, unless otherwise agreed @@ -18,19 +18,21 @@ Name: python-Genshi Version: 0.7 -Release: 1 +Release: 0 Url: http://genshi.edgewall.org/ Summary: A toolkit for generation of output for the web License: BSD-3-Clause Group: Development/Languages/Python 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 -BuildRequires: python-devel BuildRequires: python-Babel +BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: python-xml -Requires: python-xml Requires: python-Babel +Requires: python-xml Provides: python-genshi = %{version} Obsoletes: python-genshi < %{version} %if 0%{?suse_version} <= 1110 @@ -60,6 +62,7 @@ This package contains documentation and examples. %prep %setup -q -n Genshi-%{version} +%patch1 -p2 sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits %build