[Checkins] SVN: z3c.autoinclude/trunk/src/z3c/autoinclude/ miscellaneous cleanup; remove deprecated directives; provide includePluginsOverrides directive

Ethan Jucovy ejucovy at openplans.org
Sat Jan 17 13:36:50 EST 2009


Log message for revision 94805:
  miscellaneous cleanup; remove deprecated directives; provide includePluginsOverrides directive

Changed:
  U   z3c.autoinclude/trunk/src/z3c/autoinclude/meta.zcml
  U   z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py

-=-
Modified: z3c.autoinclude/trunk/src/z3c/autoinclude/meta.zcml
===================================================================
--- z3c.autoinclude/trunk/src/z3c/autoinclude/meta.zcml	2009-01-17 17:12:08 UTC (rev 94804)
+++ z3c.autoinclude/trunk/src/z3c/autoinclude/meta.zcml	2009-01-17 18:36:50 UTC (rev 94805)
@@ -3,34 +3,28 @@
     xmlns:meta="http://namespaces.zope.org/meta">
 
   <meta:directives namespace="http://namespaces.zope.org/zope">
+
     <meta:directive
         name="includeDependencies"
-        schema=".zcml.IAutoIncludeDirective"
-        handler=".zcml.autoIncludeDirective"
+        schema=".zcml.IIncludeDependenciesDirective"
+        handler=".zcml.includeDependenciesDirective"
         />
     <meta:directive
         name="includeDependenciesOverrides"
-        schema=".zcml.IAutoIncludeDirective"
-        handler=".zcml.autoIncludeOverridesDirective"
+        schema=".zcml.IIncludeDependenciesDirective"
+        handler=".zcml.includeDependenciesOverridesDirective"
         />
 
-    <!-- deprecated -->
     <meta:directive
-        name="autoinclude"
-        schema=".zcml.IAutoIncludeDirective"
-        handler=".zcml.deprecatedAutoIncludeDirective"
-        />
-    <meta:directive
-        name="autoincludeOverrides"
-        schema=".zcml.IAutoIncludeDirective"
-        handler=".zcml.deprecatedAutoIncludeOverridesDirective"
-        />
-
-    <meta:directive
         name="includePlugins"
         schema=".zcml.IIncludePluginsDirective"
         handler=".zcml.includePluginsDirective"
         />
+    <meta:directive
+        name="includePluginsOverrides"
+	schema=".zcml.IIncludePluginsDirective"
+	handler=".zcml.includePluginsOverridesDirective"
+	/>
 
   </meta:directives>
 

Modified: z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py
===================================================================
--- z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py	2009-01-17 17:12:08 UTC (rev 94804)
+++ z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py	2009-01-17 18:36:50 UTC (rev 94805)
@@ -42,6 +42,7 @@
     includeZCMLGroup(_context, dist, info, 'meta.zcml')
     includeZCMLGroup(_context, dist, info, 'configure.zcml')
 
+
 class IIncludePluginsDirective(Interface):
     """Auto-include any ZCML in the dependencies of this package."""
     
@@ -55,7 +56,7 @@
 
     file = TextLine(
         title=u"ZCML filename to look for",
-        description=u"Name of a ZCML file to look for; if omitted, autoinclude will scan for (meta, configure, overrides)",
+        description=u"Name of a particular ZCML file to look for; if omitted, autoinclude will scan for standard filenames",
         required=False,
         )
 
@@ -63,25 +64,23 @@
     dist = distributionForPackage(package)
     dotted_name = package.__name__
     if file is None:
-        zcml_candidates = ['meta.zcml', 'configure.zcml', 'overrides.zcml']
+        zcml_candidates = ['meta.zcml', 'configure.zcml']
     else:
         zcml_candidates = [file]
     info = PluginFinder(dotted_name).includableInfo(zcml_candidates)
 
     for file in zcml_candidates:
-        override = False
-        if file == 'overrides.zcml':
-            # XXX this is really a hack
-            # parallel to <includeOverrides> this should be a separate directive <includePluginsOverrides>
-            override = True
-        includeZCMLGroup(_context, dist, info, file, override=override)
+        includeZCMLGroup(_context, dist, info, file)
 
-import warnings
-def deprecatedAutoIncludeDirective(_context, package):
-    warnings.warn("The <autoinclude> directive is deprecated and will be removed in z3c.autoinclude 0.3. Please use <includeDependencies> instead.", DeprecationWarning, stacklevel=2)
-    autoIncludeDirective(_context, package)
+def includePluginsOverridesDirective(_context, package, file=None):
+    dist = distributionForPackage(package)
+    dotted_name = package.__name__
+    if file is None:
+        zcml_candidates = ['overrides.zcml']
+    else:
+        zcml_candidates = [file]
+    info = PluginFinder(dotted_name).includableInfo(zcml_candidates)
 
-def deprecatedAutoIncludeOverridesDirective(_context, package):
-    warnings.warn("The <autoincludeOverrides> directive is deprecated and will be removed in z3c.autoinclude 0.3. Please use <includeDependenciesOverrides> instead.", DeprecationWarning, stacklevel=2)
-    autoIncludeOverridesDirective(_context, package)
-
+    for file in zcml_candidates:
+        includeZCMLGroup(_context, dist, info, file, override=True)
+    



More information about the Checkins mailing list