[Checkins] SVN: zope.deprecation/trunk/ Fix
zope.deprecation.tests.warn() to have an identical signature to
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Fri Jun 27 10:02:49 EDT 2008
Log message for revision 87829:
Fix zope.deprecation.tests.warn() to have an identical signature to
warnings.warn() and to handle .pyc and .pyo files. Update changes.
Add dev marker.
Changed:
U zope.deprecation/trunk/README.txt
U zope.deprecation/trunk/setup.py
U zope.deprecation/trunk/src/zope/deprecation/tests.py
-=-
Modified: zope.deprecation/trunk/README.txt
===================================================================
--- zope.deprecation/trunk/README.txt 2008-06-27 13:38:04 UTC (rev 87828)
+++ zope.deprecation/trunk/README.txt 2008-06-27 14:02:49 UTC (rev 87829)
@@ -12,6 +12,13 @@
********
==================
+3.4.1 (unreleased)
+==================
+
+Fix zope.deprecation.warn() to make the signature identical to
+warnings.warn() and to check for *.pyc and *.pyo files.
+
+==================
3.4.0 (2007/07/19)
==================
Modified: zope.deprecation/trunk/setup.py
===================================================================
--- zope.deprecation/trunk/setup.py 2008-06-27 13:38:04 UTC (rev 87828)
+++ zope.deprecation/trunk/setup.py 2008-06-27 14:02:49 UTC (rev 87829)
@@ -25,7 +25,7 @@
name = 'zope.deprecation'
setup(
name=name,
- version = '3.4.1',
+ version = '3.4.1dev',
url='http://www.python.org/pypi/'+name,
license='ZPL 2.1',
description='Zope 3 Deprecation Infrastructure',
@@ -42,7 +42,7 @@
'Download\n'
'**********************\n'
),
-
+
package_dir = {'': 'src'},
packages=find_packages('src'),
namespace_packages=['zope',],
Modified: zope.deprecation/trunk/src/zope/deprecation/tests.py
===================================================================
--- zope.deprecation/trunk/src/zope/deprecation/tests.py 2008-06-27 13:38:04 UTC (rev 87828)
+++ zope.deprecation/trunk/src/zope/deprecation/tests.py 2008-06-27 14:02:49 UTC (rev 87829)
@@ -43,12 +43,15 @@
"""Demonstrate that deprecate() also works in a local scope."""
deprecated('demo4', 'demo4 is no more.')
-def warn(message, type_, stacklevel):
+def warn(message, category=None, stacklevel=1):
print "From tests.py's showwarning():"
-
+
frame = sys._getframe(stacklevel)
path = frame.f_globals['__file__']
file = open(path)
+ if path.endswith('.pyc') or path.endswith('.pyo'):
+ path = path[:-1]
+
lineno = frame.f_lineno
for i in range(lineno):
line = file.readline()
@@ -56,7 +59,7 @@
print "%s:%s: %s: %s\n %s" % (
path,
frame.f_lineno,
- type_.__name__,
+ category.__name__,
message,
line.strip(),
)
More information about the Checkins
mailing list