Commits

ms2ger  committed c4a0238

Follow PEP 3109 to raise exceptions.

  • Participants
  • Parent commits e955417

Comments (0)

Files changed (4)

File anolislib/processes/outliner.py

             else:
                 return -1
         else:
-            raise ValueError, "Only h1–h6 and hgroup elements have a rank"
+            raise ValueError("Only h1–h6 and hgroup elements have a rank")
 
     def build(self, **kwargs):
         for action, element in etree.iterwalk(self.ElementTree,

File anolislib/processes/refs.py

       return
     root = ElementTree.getroot().find(".//div[@id='anolis-references-%s']" % id)
     if root is None:
-      raise SyntaxError, "A <div id=anolis-references-%s> is required." % id
+      raise SyntaxError("A <div id=anolis-references-%s> is required." % id)
     dl = etree.Element("dl")
     root.append(dl)
     for ref in l:
       if not ref in self.refs:
-        raise SyntaxError, "Reference not defined: %s." % ref
+        raise SyntaxError("Reference not defined: %s." % ref)
       dt = etree.Element("dt")
       dt.set("id", "refs" + ref)
       dt.text = "[" + ref + "]\n"
   def addReferencesList(self, ElementTree, **kwargs):
     root = ElementTree.getroot().find(".//div[@id='anolis-references']")
     if root is None:
-      raise SyntaxError, "A <div id=anolis-references> is required."
+      raise SyntaxError("A <div id=anolis-references> is required.")
     dl = etree.Element("dl")
     root.append(dl)
     for ref in self.usedrefs:
       if not ref in self.refs:
-        raise SyntaxError, "Reference not defined: %s." % ref
+        raise SyntaxError("Reference not defined: %s." % ref)
       dt = etree.Element("dt")
       dt.set("id", "refs" + ref)
       dt.text = "[" + ref + "]\n"

File anolislib/processes/xref.py

                      not u"data-anolis-spec" in element.attrib and \
                      not u"data-anolis-ref" in element.attrib and \
                      not element.getparent().tag in instance_not_in_stack_with:
-                    raise SyntaxError, "Term not defined: %s, %s." % (term, element)
+                    raise SyntaxError("Term not defined: %s, %s." % (term, element))
 
     def getTerm(self, element, w3c_compat=False,
                 w3c_compat_xref_normalization=False, **kwargs):

File anolislib/processes/xspecxref.py

           element.set(u"class", u"external")
 
         if not spec in self.dfns or not self.dfns[spec]:
-          raise SyntaxError, "Specification not found: %s." % (spec, )
+          raise SyntaxError("Specification not found: %s." % spec)
         if not self.dfns[spec]["values"]:
-          raise SyntaxError, "No values for specification: %s." % (spec, )
+          raise SyntaxError("No values for specification: %s." % spec)
         if not term in self.dfns[spec]["values"]:
           self.notfound.append([term, spec])
           continue
               link.tail = link[0].tail
               link[0].tail = None
     if self.notfound:
-      raise SyntaxError, "Terms not defined: %s." % self.notfound
+      raise SyntaxError("Terms not defined: %s." % self.notfound)
 
   def getTerm(self, element, w3c_compat=False,
               w3c_compat_xref_normalization=False, **kwargs):