Commit cbe7bfbb authored by Sidnei da Silva's avatar Sidnei da Silva

- Accept new-style classes as valid warning categories. Patch by

  Ranjith Kannikara, GSoC student.
parent c6db2c5d
...@@ -35,7 +35,7 @@ def warn_category(category): ...@@ -35,7 +35,7 @@ def warn_category(category):
cat = getattr(m, klass) cat = getattr(m, klass)
except AttributeError: except AttributeError:
raise ValueError("unknown warning category: %s" % `category`) raise ValueError("unknown warning category: %s" % `category`)
if (not isinstance(cat, types.ClassType) or if (not isinstance(cat, (type, types.ClassType)) or
not issubclass(cat, Warning)): not issubclass(cat, Warning)):
raise ValueError("invalid warning category: %s" % `category`) raise ValueError("invalid warning category: %s" % `category`)
return cat return cat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment