Accepting request 286617 from devel:languages:python

1

OBS-URL: https://build.opensuse.org/request/show/286617
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Genshi?expand=0&rev=10
This commit is contained in:
Dominique Leuenberger 2015-02-22 16:25:48 +00:00 committed by Git OBS Bridge
commit db23f75ac4
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

View File

@ -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