]> granicus.if.org Git - python/commitdiff
r698@Silves: collinwinter | 2007-08-24 10:57:15 -0700
authorCollin Winter <collinw@gmail.com>
Fri, 24 Aug 2007 18:57:22 +0000 (18:57 +0000)
committerCollin Winter <collinw@gmail.com>
Fri, 24 Aug 2007 18:57:22 +0000 (18:57 +0000)
 Normalize raise statements in Lib/xml/.

Lib/xml/dom/domreg.py
Lib/xml/dom/expatbuilder.py
Lib/xml/dom/minidom.py
Lib/xml/sax/xmlreader.py

index cfd8231acedc44ac8ff1a89566e6d687ad2ad205..f653563cbfc5eac4eb263f275ad256566565365b 100644 (file)
@@ -77,7 +77,7 @@ def getDOMImplementation(name = None, features = ()):
         if _good_enough(dom, features):
             return dom
 
-    raise ImportError,"no suitable DOM implementation found"
+    raise ImportError("no suitable DOM implementation found")
 
 def _parse_feature_string(s):
     features = []
@@ -87,7 +87,7 @@ def _parse_feature_string(s):
     while i < length:
         feature = parts[i]
         if feature[0] in "0123456789":
-            raise ValueError, "bad feature name: %r" % (feature,)
+            raise ValueError("bad feature name: %r" % (feature,))
         i = i + 1
         version = None
         if i < length:
index a2f8a33834ed6d11b7a512fd30fbcf860ee49942..fdb55986259b7039e728b9f990c8deba90a01f97 100644 (file)
@@ -476,8 +476,8 @@ class FilterVisibilityController(object):
             if val == FILTER_INTERRUPT:
                 raise ParseEscape
             if val not in _ALLOWED_FILTER_RETURNS:
-                raise ValueError, \
-                      "startContainer() returned illegal value: " + repr(val)
+                raise ValueError(
+                      "startContainer() returned illegal value: " + repr(val))
             return val
         else:
             return FILTER_ACCEPT
@@ -496,8 +496,8 @@ class FilterVisibilityController(object):
                 # node is handled by the caller
                 return FILTER_REJECT
             if val not in _ALLOWED_FILTER_RETURNS:
-                raise ValueError, \
-                      "acceptNode() returned illegal value: " + repr(val)
+                raise ValueError(
+                      "acceptNode() returned illegal value: " + repr(val))
             return val
         else:
             return FILTER_ACCEPT
index fb57d586471cf785ea3748d6be4192474590f5f6..03862882aa2a0ecdc5ea036c0aa1fee950f62cf3 100644 (file)
@@ -541,7 +541,7 @@ class NamedNodeMap(object):
             node.value = value
         else:
             if not isinstance(value, Attr):
-                raise TypeError, "value must be a string or Attr object"
+                raise TypeError("value must be a string or Attr object")
             node = value
             self.setNamedItem(node)
 
@@ -1177,7 +1177,7 @@ class ReadOnlySequentialNamedNodeMap(object):
         else:
             node = self.getNamedItem(name_or_tuple)
         if node is None:
-            raise KeyError, name_or_tuple
+            raise KeyError(name_or_tuple)
         return node
 
     def item(self, index):
@@ -1607,7 +1607,7 @@ class Document(Node, DocumentLS):
 
     def createTextNode(self, data):
         if not isinstance(data, StringTypes):
-            raise TypeError, "node contents must be a string"
+            raise TypeError("node contents must be a string")
         t = Text()
         t.data = data
         t.ownerDocument = self
@@ -1615,7 +1615,7 @@ class Document(Node, DocumentLS):
 
     def createCDATASection(self, data):
         if not isinstance(data, StringTypes):
-            raise TypeError, "node contents must be a string"
+            raise TypeError("node contents must be a string")
         c = CDATASection()
         c.data = data
         c.ownerDocument = self
index 45033152cd069fe65da6204fcd7dae247d198bf7..6264ee3f0189b433194f48228c02288b6fe8ed1a 100644 (file)
@@ -295,12 +295,12 @@ class AttributesImpl:
 
     def getNameByQName(self, name):
         if name not in self._attrs:
-            raise KeyError, name
+            raise KeyError(name)
         return name
 
     def getQNameByName(self, name):
         if name not in self._attrs:
-            raise KeyError, name
+            raise KeyError(name)
         return name
 
     def getNames(self):
@@ -350,14 +350,14 @@ class AttributesNSImpl(AttributesImpl):
             if qname == name:
                 return self._attrs[nsname]
 
-        raise KeyError, name
+        raise KeyError(name)
 
     def getNameByQName(self, name):
         for (nsname, qname) in self._qnames.items():
             if qname == name:
                 return nsname
 
-        raise KeyError, name
+        raise KeyError(name)
 
     def getQNameByName(self, name):
         return self._qnames[name]