[python-twisted-words] - Fixed crash on space-containing xmlns IRI (RH #603800)
belegdol
belegdol at fedoraproject.org
Thu Sep 30 19:51:06 UTC 2010
commit 38d274fc87832b07bc41d2d2e7bc8ca490857d54
Author: Julian Sikorski <belegdol at gmail.com>
Date: Thu Sep 30 21:51:07 2010 +0200
- Fixed crash on space-containing xmlns IRI (RH #603800)
changeset_r29852.diff | 70 +++++++++++++++++++++++++++++++++++++++++++++
python-twisted-words.spec | 7 ++++-
2 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/changeset_r29852.diff b/changeset_r29852.diff
new file mode 100644
index 0000000..9e1408b
--- /dev/null
+++ b/changeset_r29852.diff
@@ -0,0 +1,70 @@
+Index: /trunk/twisted/topfiles/4503.bugfix
+===================================================================
+--- /trunk/twisted/topfiles/4503.bugfix (revision 29852)
++++ /trunk/twisted/topfiles/4503.bugfix (revision 29852)
+@@ -0,0 +1,1 @@
++twisted.words.xish.domish now correctly parses XML with namespaces which include whitespace.
+Index: /trunk/twisted/words/test/test_domish.py
+===================================================================
+--- /trunk/twisted/words/test/test_domish.py (revision 25184)
++++ /trunk/twisted/words/test/test_domish.py (revision 29852)
+@@ -1,3 +1,3 @@
+-# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
++# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
+ # See LICENSE for details.
+
+@@ -199,4 +199,17 @@
+ self.assertEquals(self.elements[0].child2.uri, '')
+
++
++ def test_namespaceWithWhitespace(self):
++ """
++ Whitespace in an xmlns value is preserved in the resulting node's C{uri}
++ attribute.
++ """
++ xml = "<root xmlns:foo=' bar baz '><foo:bar foo:baz='quux'/></root>"
++ self.stream.parse(xml)
++ self.assertEquals(self.elements[0].uri, " bar baz ")
++ self.assertEquals(
++ self.elements[0].attributes, {(" bar baz ", "baz"): "quux"})
++
++
+ def testChildPrefix(self):
+ xml = "<root xmlns='testns' xmlns:foo='testns2'><foo:child/></root>"
+Index: /trunk/twisted/words/xish/domish.py
+===================================================================
+--- /trunk/twisted/words/xish/domish.py (revision 25184)
++++ /trunk/twisted/words/xish/domish.py (revision 29852)
+@@ -1,5 +1,4 @@
+ # -*- test-case-name: twisted.words.test.test_domish -*-
+-#
+-# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
++# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
+ # See LICENSE for details.
+
+@@ -72,5 +71,4 @@
+
+ # Further optimizations
+- parent = elem.parent
+ name = elem.name
+ uri = elem.uri
+@@ -759,6 +757,8 @@
+
+ def _onStartElement(self, name, attrs):
+- # Generate a qname tuple from the provided name
+- qname = name.split(" ")
++ # Generate a qname tuple from the provided name. See
++ # http://docs.python.org/library/pyexpat.html#xml.parsers.expat.ParserCreate
++ # for an explanation of the formatting of name.
++ qname = name.rsplit(" ", 1)
+ if len(qname) == 1:
+ qname = ('', name)
+@@ -766,6 +766,6 @@
+ # Process attributes
+ for k, v in attrs.items():
+- if k.find(" ") != -1:
+- aqname = k.split(" ")
++ if " " in k:
++ aqname = k.rsplit(" ", 1)
+ attrs[(aqname[0], aqname[1])] = v
+ del attrs[k]
diff --git a/python-twisted-words.spec b/python-twisted-words.spec
index 1211ff0..e682851 100644
--- a/python-twisted-words.spec
+++ b/python-twisted-words.spec
@@ -3,12 +3,13 @@
Name: %{python}-twisted-words
Version: 10.1.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Twisted Instant Messaging implementations
Group: Development/Libraries
License: MIT
URL: http://twistedmatrix.com/trac/wiki/TwistedWords
Source0: http://tmrc.mit.edu/mirror/twisted/Words/10.1/TwistedWords-%{version}.tar.bz2
+Patch0: changeset_r29852.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: %{python}-twisted-core >= %{version}
BuildRequires: %{python}-devel
@@ -32,6 +33,7 @@ an XPath-like toolkit.
%prep
%setup -q -n TwistedWords-%{version}
+%patch0 -p2 -b .29852
# Fix doc permissions
chmod -x doc/examples/oscardemo.py
@@ -73,6 +75,9 @@ fi
%{python_sitearch}/twisted/plugins/twisted_words.py*
%changelog
+* Thu Sep 30 2010 Julian Sikorski <belegdol at fedoraproject.org> - 10.1.0-2
+- Fixed crash on space-containing xmlns IRI (RH #603800)
+
* Tue Sep 21 2010 Julian Sikorski <belegdol at fedoraproject.org> - 10.1.0-1
- Updated to 10.1.0
- Switched to macros for versioned dependencies
More information about the scm-commits
mailing list