]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Do not use the default namespace for attributes.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 2 May 2004 20:37:47 +0000 (20:37 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 2 May 2004 20:37:47 +0000 (20:37 +0000)
Fixes http://bugs.debian.org/229885

Lib/xmllib.py

index cdc861eb6894941941f02061b050a3e553ba5112..7eccd966e03b836d0af17a4a249f6e88e100733f 100644 (file)
@@ -6,8 +6,7 @@ import re
 import string
 
 import warnings
-warnings.warn("The xmllib module is obsolete.  Use xml.sax instead.",
-              DeprecationWarning)
+warnings.warn("The xmllib module is obsolete.  Use xml.sax instead.", DeprecationWarning)
 del warnings
 
 version = '0.3'
@@ -641,20 +640,17 @@ class XMLParser:
                     aprefix, key = res.group('prefix', 'local')
                     if self.__map_case:
                         key = key.lower()
-                    if aprefix is None:
-                        aprefix = ''
-                    ans = None
-                    for t, d, nst in self.stack:
-                        if aprefix in d:
-                            ans = d[aprefix]
-                    if ans is None and aprefix != '':
-                        ans = self.__namespaces.get(aprefix)
-                    if ans is not None:
-                        key = ans + ' ' + key
-                    elif aprefix != '':
-                        key = aprefix + ':' + key
-                    elif ns is not None:
-                        key = ns + ' ' + key
+                    if aprefix is not None:
+                        ans = None
+                        for t, d, nst in self.stack:
+                            if aprefix in d:
+                                ans = d[aprefix]
+                        if ans is None:
+                            ans = self.__namespaces.get(aprefix)
+                        if ans is not None:
+                            key = ans + ' ' + key
+                        else:
+                            key = aprefix + ':' + key
                 nattrdict[key] = val
                 attrnamemap[key] = okey
             attrdict = nattrdict