[Zope-Checkins] SVN: Zope/branches/2.11/ Suppressed DeprecationWarning during import of ZPublisher.Iterators.

Tres Seaver tseaver at palladion.com
Mon Jul 14 13:20:30 EDT 2008


Log message for revision 88361:
  Suppressed DeprecationWarning during import of ZPublisher.Iterators.
  
  o That module needs to use Z2-style interfaces in 2.11, for BBB, but
    the Interface module itself issues the warning on import.
  

Changed:
  U   Zope/branches/2.11/doc/CHANGES.txt
  U   Zope/branches/2.11/lib/python/ZPublisher/Iterators.py

-=-
Modified: Zope/branches/2.11/doc/CHANGES.txt
===================================================================
--- Zope/branches/2.11/doc/CHANGES.txt	2008-07-14 16:33:42 UTC (rev 88360)
+++ Zope/branches/2.11/doc/CHANGES.txt	2008-07-14 17:20:30 UTC (rev 88361)
@@ -8,6 +8,10 @@
 
     Bugs Fixed
 
+      - Suppressed DeprecationWarning during import of ZPublisher.Iterators:
+        that module needs to use Z2-style interfaces in 2.11, for BBB, but
+        the Interface module itself issues the warning on import.
+
       - Launchpad #246748: added 'immediate' option to sendXXX() methods
         for sending a mail immediately by-passing the zope.sendmail delivery
         mechanism

Modified: Zope/branches/2.11/lib/python/ZPublisher/Iterators.py
===================================================================
--- Zope/branches/2.11/lib/python/ZPublisher/Iterators.py	2008-07-14 16:33:42 UTC (rev 88360)
+++ Zope/branches/2.11/lib/python/ZPublisher/Iterators.py	2008-07-14 17:20:30 UTC (rev 88361)
@@ -1,5 +1,15 @@
-from Interface import Interface
+import warnings
 
+# The Z2 Interface module is deprecated:  in Zope 2.12, this module will use
+# Z3 interfaces instead.  Meanwhile, silence the deprecation warning.
+_existing_filters = warnings.filters[:]
+warnings.filterwarnings('ignore', category=DeprecationWarning)
+try:
+    from Interface import Interface
+finally:
+    warnings.filters[:] = _existing_filters
+    del _existing_filters
+
 class IStreamIterator(Interface):
     """
     An iterator that can be published.



More information about the Zope-Checkins mailing list