[Checkins] SVN: Sandbox/nadako/zope.browserresource/src/zope/browserresource/metaconfigure.py Raise more sensible deprecation warnings with filename and line.

Dan Korostelev nadako at gmail.com
Mon Aug 24 08:47:12 EDT 2009


Log message for revision 103146:
  Raise more sensible deprecation warnings with filename and line.

Changed:
  U   Sandbox/nadako/zope.browserresource/src/zope/browserresource/metaconfigure.py

-=-
Modified: Sandbox/nadako/zope.browserresource/src/zope/browserresource/metaconfigure.py
===================================================================
--- Sandbox/nadako/zope.browserresource/src/zope/browserresource/metaconfigure.py	2009-08-24 12:44:47 UTC (rev 103145)
+++ Sandbox/nadako/zope.browserresource/src/zope/browserresource/metaconfigure.py	2009-08-24 12:47:11 UTC (rev 103146)
@@ -74,11 +74,13 @@
 
     if image or template:
         import warnings
-        warnings.warn('The "template" and "image" attributes of resource '
-                      'directive are deprecated in favor of pluggable '
-                      'file resource factories based on file extensions. '
-                      'Use the "file" attribute instead.',
-                      DeprecationWarning)
+        warnings.warn_explicit(
+            'The "template" and "image" attributes of resource '
+            'directive are deprecated in favor of pluggable '
+            'file resource factories based on file extensions. '
+            'Use the "file" attribute instead.',
+            DeprecationWarning,
+            _context.info.file, _context.info.line)
         if image:
             file = image
         elif template:
@@ -203,10 +205,12 @@
 
         if image is not None:
             import warnings
-            warnings.warn('The "image" attribute of i18n-resource directive is '
-                          'deprecated in favor of simple files. Use the "file" '
-                          'attribute instead.',
-                          DeprecationWarning)
+            warnings.warn_explicit(
+                'The "image" attribute of i18n-resource directive is '
+                'deprecated in favor of simple files. Use the "file" '
+                'attribute instead.',
+                DeprecationWarning,
+                _context.info.file, _context.info.line)
             file = image
 
         self.__data[language] = File(_context.path(file), self.name)



More information about the Checkins mailing list