[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZGadflyDA/__init__.py Don't warn when the ZGadflyDA is imported by Zope startup code.

Florent Guillaume fg at nuxeo.com
Thu Jun 1 08:18:12 EDT 2006


Log message for revision 68441:
  Don't warn when the ZGadflyDA is imported by Zope startup code.

Changed:
  U   Zope/trunk/lib/python/Products/ZGadflyDA/__init__.py

-=-
Modified: Zope/trunk/lib/python/Products/ZGadflyDA/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/ZGadflyDA/__init__.py	2006-06-01 12:17:15 UTC (rev 68440)
+++ Zope/trunk/lib/python/Products/ZGadflyDA/__init__.py	2006-06-01 12:18:11 UTC (rev 68441)
@@ -15,11 +15,14 @@
 $Id$
 """
 
-import warnings
-warnings.warn('Using Gadfly and ZGadflyDA is deprecated. The module will be '
-              'removed in Zope 2.11)', 
-              DeprecationWarning,
-              stacklevel=2) 
+# Don't warn when the product is imported by the startup code
+import sys
+if sys._getframe(1).f_code.co_name != 'import_product': # OFS.Application
+    import warnings
+    warnings.warn('Using Gadfly and ZGadflyDA is deprecated. '
+                  'The module will be removed in Zope 2.11)',
+                  DeprecationWarning,
+                  stacklevel=2)
 
 import Globals, os
 



More information about the Zope-Checkins mailing list