[Checkins] SVN: z3c.autoinclude/trunk/ allow directive to pass in a specific filename to try to load (sort of conceptually WIP)

Ethan Jucovy ejucovy at openplans.org
Thu Jan 15 18:56:14 EST 2009


Log message for revision 94771:
  allow directive to pass in a specific filename to try to load (sort of conceptually WIP)

Changed:
  U   z3c.autoinclude/trunk/CHANGES.txt
  U   z3c.autoinclude/trunk/setup.py
  U   z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py

-=-
Modified: z3c.autoinclude/trunk/CHANGES.txt
===================================================================
--- z3c.autoinclude/trunk/CHANGES.txt	2009-01-15 23:53:20 UTC (rev 94770)
+++ z3c.autoinclude/trunk/CHANGES.txt	2009-01-15 23:56:14 UTC (rev 94771)
@@ -4,7 +4,10 @@
 0.2.3 (unreleased)
 ------------------
 
+* Allow virtual namespace packages like 'plone' to be used as targets. I think this may need more thought for the 'dependency' case.
+* Allow ZCML <includePlugins> directive to specify a particular ZCML file to try to load from plugins, so that loading of meta, configure and overrides can be split across three ZCML files if desired.
 
+
 0.2.2 (2008-04-22)
 ------------------
 

Modified: z3c.autoinclude/trunk/setup.py
===================================================================
--- z3c.autoinclude/trunk/setup.py	2009-01-15 23:53:20 UTC (rev 94770)
+++ z3c.autoinclude/trunk/setup.py	2009-01-15 23:56:14 UTC (rev 94771)
@@ -25,6 +25,7 @@
       include_package_data=True,
       zip_safe=False,
       install_requires=[
+          'PasteScript',
           'setuptools',
           'zope.dottedname',
 	  'zope.interface',
@@ -33,8 +34,9 @@
           'zc.buildout',
           # -*- Extra requirements: -*-
       ],
-      extras_require={'test': ['zc.buildout',]},
+      extras_require={'test': ['zc.buildout','zope.testing']},
       entry_points="""
-      # -*- Entry points: -*-
+      [console_scripts]
+      autoinclude-test = z3c.autoinclude.tests.tests:interactive_testing_env
       """,
       )

Modified: z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py
===================================================================
--- z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py	2009-01-15 23:53:20 UTC (rev 94770)
+++ z3c.autoinclude/trunk/src/z3c/autoinclude/zcml.py	2009-01-15 23:56:14 UTC (rev 94771)
@@ -2,6 +2,7 @@
 from zope.configuration.xmlconfig import include, includeOverrides
 from zope.configuration.fields import GlobalObject
 from zope.dottedname.resolve import resolve
+from zope.schema import TextLine
 
 from z3c.autoinclude.dependency import DependencyFinder
 from z3c.autoinclude.utils import debug_includes
@@ -52,16 +53,26 @@
         required=True,
         )
 
-def includePluginsDirective(_context, package):
+    filename = 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)",
+        required=False,
+        )
+
+def includePluginsDirective(_context, package, filename=None):
     dist = distributionForPackage(package)
     dotted_name = package.__name__
-    info = PluginFinder(dotted_name).includableInfo(['meta.zcml',
-                                                     'configure.zcml',
-                                                     'overrides.zcml'])
+    if filename is None:
+        zcml_candidates = ['meta.zcml', 'configure.zcml', 'overrides.zcml']
+    else:
+        zcml_candidates = [filename]
+    info = PluginFinder(dotted_name).includableInfo(zcml_candidates)
 
-    includeZCMLGroup(_context, dist, info, 'meta.zcml')
-    includeZCMLGroup(_context, dist, info, 'configure.zcml')
-    includeZCMLGroup(_context, dist, info, 'overrides.zcml', override=True)
+    for filename in zcml_candidates:
+        override = False
+        if filename == 'overrides.zcml':
+            override = True
+        includeZCMLGroup(_context, dist, info, filename, override=override)
 
 import warnings
 def deprecatedAutoIncludeDirective(_context, package):



More information about the Checkins mailing list