[Zope3-checkins] SVN: Zope3/branches/srichter-blow-services/src/zope/deprecation/deprecation.py Improved module detection.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Feb 12 21:49:45 EST 2005


Log message for revision 29132:
  Improved module detection.
  

Changed:
  U   Zope3/branches/srichter-blow-services/src/zope/deprecation/deprecation.py

-=-
Modified: Zope3/branches/srichter-blow-services/src/zope/deprecation/deprecation.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/deprecation/deprecation.py	2005-02-13 02:49:24 UTC (rev 29131)
+++ Zope3/branches/srichter-blow-services/src/zope/deprecation/deprecation.py	2005-02-13 02:49:44 UTC (rev 29132)
@@ -79,13 +79,16 @@
     """Deprecate the given names."""
 
     # We are inside a module
-    locals = sys._getframe(2).f_locals
-    if 'modname' in locals:
-        modname = locals['modname']
+    if isinstance(specifier, (str, unicode, list, tuple)):
+        locals = sys._getframe(1).f_locals
+        if '__name__' in locals:
+            modname = locals['__name__']
+            
         if not isinstance(sys.modules[modname], DeprecationProxy):
             sys.modules[modname] = DeprecationProxy(sys.modules[modname])
         sys.modules[modname].deprecate(specifier, message)
         
+
     # ... that means the specifier is a method or attribute of the class
     if isinstance(specifier, types.FunctionType):
         return DeprecatedMethod(specifier, message)



More information about the Zope3-Checkins mailing list