Commit 1e37f12a authored by Chris McDonough's avatar Chris McDonough

Remove warnfilter options (move to Zope.Startup).

parent d81bfb3a
...@@ -58,12 +58,4 @@ ...@@ -58,12 +58,4 @@
<multisection type="zLOG.loghandler" attribute="handlers" name="*"/> <multisection type="zLOG.loghandler" attribute="handlers" name="*"/>
</sectiontype> </sectiontype>
<sectiontype name="warnfilter" datatype=".warning_filter_handler">
<key name="action" datatype=".warn_action" default="default"/>
<key name="message" default=""/>
<key name="category" datatype=".warning_subclass" default="Warning"/>
<key name="module" default=""/>
<key name="lineno" datatype="integer" default="0"/>
</sectiontype>
</component> </component>
...@@ -257,31 +257,3 @@ def importable_name(name): ...@@ -257,31 +257,3 @@ def importable_name(name):
except ImportError: except ImportError:
raise ValueError, ( raise ValueError, (
'The object named by "%s" could not be imported' % name ) 'The object named by "%s" could not be imported' % name )
def warning_subclass(val):
ob = importable_name(val) # will fail in course
try:
if not issubclass(ob, Warning):
raise ValueError, (
'warning category "%s" must be a Warning subclass' % val)
except TypeError:
raise ValueError, (
'warning category "%s" must be a Warning subclass' % val)
return ob
def warn_action(val):
OK = ("error", "ignore", "always", "default", "module", "once")
if val not in OK:
raise ValueError, "warning action %s not one of %s" % (val, OK)
return val
def warning_filter_handler(section):
import warnings
# add the warning filter
warnings.filterwarnings(section.action, section.message, section.category,
section.module, section.lineno, 1)
return section
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