Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
62d6e254
Commit
62d6e254
authored
Aug 07, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move zope.conf warnfilter into ZServer.
parent
70b5d923
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
103 deletions
+36
-103
develop/ZServer/src/ZServer/Zope2/Startup/tests/test_warnfilter.py
...Server/src/ZServer/Zope2/Startup/tests/test_warnfilter.py
+0
-0
src/Zope2/Startup/warnfilter.py
src/Zope2/Startup/warnfilter.py
+0
-58
src/Zope2/Startup/warnfilter.xml
src/Zope2/Startup/warnfilter.xml
+0
-9
src/Zope2/Startup/wsgischema.xml
src/Zope2/Startup/wsgischema.xml
+0
-36
src/Zope2/Startup/zopeschema.xml
src/Zope2/Startup/zopeschema.xml
+36
-0
No files found.
src
/Zope2/Startup/tests/test_warnfilter.py
→
develop/ZServer/src/ZServer
/Zope2/Startup/tests/test_warnfilter.py
View file @
62d6e254
File moved
src/Zope2/Startup/warnfilter.py
deleted
100644 → 0
View file @
70b5d923
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Datatypes for warning filter component """
import
re
import
warnings
def
warn_category
(
category
):
if
not
category
:
return
Warning
if
re
.
match
(
"^[a-zA-Z0-9_]+$"
,
category
):
try
:
cat
=
eval
(
category
)
except
NameError
:
raise
ValueError
(
"unknown warning category: %r"
%
category
)
else
:
i
=
category
.
rfind
(
"."
)
module
=
category
[:
i
]
klass
=
category
[
i
+
1
:]
try
:
m
=
__import__
(
module
,
None
,
None
,
[
klass
])
except
ImportError
:
raise
ValueError
(
"invalid module name: %r"
%
module
)
try
:
cat
=
getattr
(
m
,
klass
)
except
AttributeError
:
raise
ValueError
(
"unknown warning category: %r"
%
category
)
if
(
not
isinstance
(
cat
,
type
(
Warning
))
or
not
issubclass
(
cat
,
Warning
)):
raise
ValueError
(
"invalid warning category: %r"
%
category
)
return
cat
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
):
# add the warning filter
warnings
.
filterwarnings
(
section
.
action
,
section
.
message
,
section
.
category
,
section
.
module
,
section
.
lineno
)
return
section
src/Zope2/Startup/warnfilter.xml
deleted
100644 → 0
View file @
70b5d923
<component
prefix=
"Zope2.Startup.warnfilter"
>
<sectiontype
name=
"warnfilter"
datatype=
".warning_filter_handler"
>
<key
name=
"action"
datatype=
".warn_action"
default=
"default"
/>
<key
name=
"message"
default=
""
/>
<key
name=
"category"
datatype=
".warn_category"
default=
"Warning"
/>
<key
name=
"module"
default=
""
/>
<key
name=
"lineno"
datatype=
"integer"
default=
"0"
/>
</sectiontype>
</component>
src/Zope2/Startup/wsgischema.xml
View file @
62d6e254
...
...
@@ -7,7 +7,6 @@
<import
package=
"ZConfig.components.logger"
file=
"handlers.xml"
/>
<import
package=
"ZConfig.components.logger"
file=
"eventlog.xml"
/>
<import
package=
"ZODB"
/>
<import
package=
"Zope2.Startup"
file=
"warnfilter.xml"
/>
<sectiontype
name=
"logger"
datatype=
".LoggerFactory"
>
<description>
...
...
@@ -102,41 +101,6 @@
<!-- schema begins -->
<multisection
type=
"warnfilter"
name=
"*"
attribute=
"warnfilters"
>
<!-- from zLOG -->
<description>
A multisection which allows a user to set up a Python "warning" filter.
The following keys are valid within a warnfilter section:
action: one of the following strings:
"error" turn matching warnings into exceptions
"ignore" never print matching warnings
"always" always print matching warnings
"default" print the first occurrence of matching warnings
for each location where the warning is issued
"module" print the first occurrence of matching warnings
for each module where the warning is issued
"once" print only the first occurrence of matching
warnings, regardless of location
message: a string containing a regular expression that the
warning message must match (the match is compiled to
always be case-insensitive)
category: a Python dotted-path classname (must be a subclass of
Warning) of which the warning category must be a subclass in
order to match
module: a string containing a regular expression that the
module name must match (the match is compiled to be
case-sensitive)
lineno: an integer that the line number where the warning
occurred must match, or 0 to match all line numbers
</description>
</multisection>
<section
type=
"environment"
attribute=
"environment"
name=
"*"
>
<description>
A section which allows a user to define arbitrary key-value pairs for
...
...
src/Zope2/Startup/zopeschema.xml
View file @
62d6e254
...
...
@@ -7,6 +7,7 @@
<import
package=
"tempstorage"
condition=
"tempstorage"
/>
<import
package=
"ZServer"
/>
<import
package=
"ZServer.Zope2.Startup"
file=
"warnfilter.xml"
/>
<sectiontype
name=
"cgi-environment"
datatype=
".cgi_environment"
...
...
@@ -171,6 +172,41 @@
<!-- schema begins -->
<multisection
type=
"warnfilter"
name=
"*"
attribute=
"warnfilters"
>
<!-- from zLOG -->
<description>
A multisection which allows a user to set up a Python "warning" filter.
The following keys are valid within a warnfilter section:
action: one of the following strings:
"error" turn matching warnings into exceptions
"ignore" never print matching warnings
"always" always print matching warnings
"default" print the first occurrence of matching warnings
for each location where the warning is issued
"module" print the first occurrence of matching warnings
for each module where the warning is issued
"once" print only the first occurrence of matching
warnings, regardless of location
message: a string containing a regular expression that the
warning message must match (the match is compiled to
always be case-insensitive)
category: a Python dotted-path classname (must be a subclass of
Warning) of which the warning category must be a subclass in
order to match
module: a string containing a regular expression that the
module name must match (the match is compiled to be
case-sensitive)
lineno: an integer that the line number where the warning
occurred must match, or 0 to match all line numbers
</description>
</multisection>
<multikey
name=
"products"
datatype=
"existing-directory"
>
<description>
This specifies a product directory which is added to Products.__path__.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment