[Zope-Checkins] SVN: Zope/branches/2.10/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:17:16 EDT 2006


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

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

-=-
Modified: Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py	2006-06-01 11:59:22 UTC (rev 68439)
+++ Zope/branches/2.10/lib/python/Products/ZGadflyDA/__init__.py	2006-06-01 12:17:15 UTC (rev 68440)
@@ -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