[Zope3-checkins] SVN: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/ Deprecate the 'content' alias for the 'class' directive. Man, that's a lot of

Philipp von Weitershausen philikon at philikon.de
Wed Mar 15 11:03:37 EST 2006


Log message for revision 66040:
  Deprecate the 'content' alias for the 'class' directive. Man, that's a lot of
  deprecation warnings...
  

Changed:
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/component/contentdirective.py
  U   Zope3/branches/philikon-reduce-zcml/src/zope/app/component/meta.zcml

-=-
Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/contentdirective.py
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/component/contentdirective.py	2006-03-15 16:01:58 UTC (rev 66039)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/component/contentdirective.py	2006-03-15 16:03:37 UTC (rev 66040)
@@ -1,4 +1,4 @@
-##############################################################################
+#############################################################################
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
@@ -17,6 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
+import warnings
 from types import ModuleType
 from persistent.interfaces import IPersistent
 from zope.component.interfaces import IFactory
@@ -45,7 +46,7 @@
     """Security-protection-specific exceptions."""
     pass
 
-class ContentDirective(object):
+class ClassDirective(object):
 
     def __init__(self, _context, class_):
         self.__id = dottedName(class_)
@@ -175,8 +176,17 @@
         utility(_context, IFactory, factoryObj,
                 permission=PublicPermission, name=id)
 
+# BBB 2006/02/24, to be removed after 12 months
+class ContentDirective(ClassDirective):
 
-class LocalUtilityDirective(ContentDirective):
+    def __init__(self, _context, class_):
+        warnings.warn_explicit(
+            "The 'content' alias for the 'class' directive has been "
+            "deprecated and will be removed in Zope 3.5.\n",
+            DeprecationWarning, _context.info.file, _context.info.line)        
+        super(ContentDirective, self).__init__(_context, class_)
+
+class LocalUtilityDirective(ClassDirective):
     r"""localUtility directive handler.
 
     Examples:

Modified: Zope3/branches/philikon-reduce-zcml/src/zope/app/component/meta.zcml
===================================================================
--- Zope3/branches/philikon-reduce-zcml/src/zope/app/component/meta.zcml	2006-03-15 16:01:58 UTC (rev 66039)
+++ Zope3/branches/philikon-reduce-zcml/src/zope/app/component/meta.zcml	2006-03-15 16:03:37 UTC (rev 66040)
@@ -64,7 +64,7 @@
     <meta:complexDirective
         name="class"
         schema=".metadirectives.IClassDirective"
-        handler=".contentdirective.ContentDirective"
+        handler=".contentdirective.ClassDirective"
         >
 
       <meta:subdirective
@@ -89,6 +89,7 @@
 
     </meta:complexDirective>
 
+    <!-- BBB 2006/02/24, to be removed after 12 months -->
     <meta:complexDirective
         name="content"
         schema=".metadirectives.IClassDirective"



More information about the Zope3-Checkins mailing list