[Zope3-checkins] SVN: Zope3/branches/baijum-zope-app-zcmlfiles/ Experimental implementation of LoadingConfigurationFromTheZopeAppEgg

Baiju M baiju.m.mail at gmail.com
Thu Dec 21 01:21:52 EST 2006


Log message for revision 71641:
  Experimental implementation of LoadingConfigurationFromTheZopeAppEgg
  

Changed:
  U   Zope3/branches/baijum-zope-app-zcmlfiles/ftesting-base.zcml
  U   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/__init__.py
  U   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/codemodule/module.py
  U   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/zcmlmodule/tests.py
  D   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/browser.zcml
  D   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml
  D   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/ftesting.zcml
  D   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/menus.zcml
  D   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/meta.zcml
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/__init__.py
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/browser.zcml
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/configure.zcml
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/ftesting.zcml
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/menus.zcml
  A   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/meta.zcml
  U   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/tests/test_xmlconfig.py
  U   Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/xmlconfig.py

-=-
Modified: Zope3/branches/baijum-zope-app-zcmlfiles/ftesting-base.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/ftesting-base.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/ftesting-base.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -7,8 +7,8 @@
   <!-- This file is the equivalent of site.zcml and it is -->
   <!-- used for functional testing setup -->
 
-  <include package="zope.app" />
-  <include package="zope.app" file="ftesting.zcml" />
+  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app.zcmlfiles" file="ftesting.zcml" />
 
   <include files="zopeskel/etc/package-includes/*-meta.zcml" />
   <include files="zopeskel/etc/package-includes/*-configure.zcml" />

Modified: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/__init__.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/__init__.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/__init__.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -15,4 +15,10 @@
 
 $Id$
 """
+try:
+    #Declare this a namespace package if pkg_resources is available.
+    import pkg_resources
+    pkg_resources.declare_namespace('zope.app')
+except ImportError:
+    pass
 

Modified: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/codemodule/module.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/codemodule/module.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/codemodule/module.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -34,6 +34,9 @@
 from zope.app.apidoc.codemodule.text import TextFile
 from zope.app.apidoc.codemodule.zcml import ZCMLFile
 
+# XXX This should be imported somewhere?
+import zope.app.zcmlfiles
+
 # Ignore these files, since they are not necessary or cannot be imported
 # correctly.
 IGNORE_FILES = ('tests', 'tests.py', 'ftests', 'ftests.py', 'CVS', 'gadfly',

Modified: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/zcmlmodule/tests.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/zcmlmodule/tests.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/apidoc/zcmlmodule/tests.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -46,7 +46,7 @@
     global old_context
     old_context = zope.app.appsetup.appsetup.getConfigContext()
     zope.app.appsetup.appsetup.__config_context = xmlconfig.file(
-        config_file, execute=False)
+        config_file, zope.app, execute=False)
 
 def tearDown(test):
     placelesssetup.tearDown()

Deleted: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/browser.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/browser.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/browser.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -1,17 +0,0 @@
-<configure
-   xmlns="http://namespaces.zope.org/zope"
-   xmlns:browser="http://namespaces.zope.org/browser">
-
-  <browser:defaultView name="index.html" />
-  <browser:defaultSkin name="Rotterdam" />
-
-  <include package="zope.app.exception.browser" />
-  <include package="zope.traversing.browser" />
-  <include package="zope.app.security.browser" />
-
-  <include package="zope.app.container.browser" />
-  <include package="zope.app.form.browser" />
-
-  <include package="zope.app.component.browser" />
-
-</configure>

Deleted: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -1,83 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:i18n="http://namespaces.zope.org/i18n"
-    i18n_domain="zope"
-    >
-
-  <!-- Meta configuration (new directives) -->
-  <include file="meta.zcml" />
-
-  <!-- Note that we need to do this early, as later startup
-       subscribers may break without fixups -->
-
-  <include package="zope.app.component" />
-
-  <include package=".generations" file="subscriber.zcml" />
-
-  <!-- Ordinary Application (non-view) configuration) -->
-  <include package="zope.app.interface" />
-  <include package="zope.app.security" />
-  <include package="zope.component" />
-  <include package="zope.annotation" />
-  <include package="zope.app.dependable" />
-  <include package="zope.app.content" />
-  <include package="zope.publisher" />
-
-  <include file="menus.zcml" />
-
-  <include package="zope.copypastemove" />
-  <include package="zope.size" />
-  <include package="zope.location" />
-  <include package="zope.app.container" />
-
-  <include package="zope.app.publisher" />
-
-  <include package="zope.app.publication" file="meta.zcml" />
-  <include package="zope.app.publication" />
-
-
-  <include package="zope.traversing" />
-  <include package="zope.app.pagetemplate" />
-  <include package=".generations" />
-  <include package=".zapi" />
-
-  <!-- Views -->
-  <include package="zope.app.http" />
-
-  <!-- Translations -->
-  <i18n:registerTranslations directory="locales" />
-
-  <include package="zope.app.i18n" />
-
-  <!-- Database boostrapping and maintanance -->
-  <include package=".appsetup" />
-  <include package=".zopeappgenerations" />
-
-  <!-- Services -->
-  <include package="zope.app.principalannotation" />
-
-  <!-- Utilities -->
-  <include package="zope.app.error" />
-
-  <!-- Broken-object support -->
-  <include package="zope.app.broken" />
-
-  <!-- Skins -->
-
-  <include package="zope.app.basicskin" />
-  <include package="zope.app.rotterdam" />
-
-  <!-- Additional packages -->
-
-  <include package="zope.app.applicationcontrol" />
-  <include package="zope.dublincore" />
-  <include package="zope.app.wsgi" />
-
-
-  <!-- Content types -->
-  <include package="zope.app.folder" />
-
-  <!-- Browser Configurations -->
-  <include file="browser.zcml" />
-
-</configure>

Deleted: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/ftesting.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/ftesting.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/ftesting.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -1,11 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    xmlns:i18n="http://namespaces.zope.org/i18n"
-    i18n_domain="zope"
-    >
-
-<include package=".container.browser.ftests" />
-<include package=".pagetemplate.ftests" />
-<include package=".form.browser.ftests" file="i18n.zcml" />
-
-</configure>

Deleted: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/menus.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/menus.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/menus.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -1,37 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/browser"
-    i18n_domain="zope">
-
-  <menu
-      id="zmi_views"
-      title="Views"
-      description="Menu for displaying alternate representations of an object"
-      />
-
-  <menu
-      id="zmi_actions"
-      title="Actions"
-      description="Menu for displaying actions to be performed"
-      />
-
-  <menu
-      id="zope.app.container.add"
-      title="Add"
-      description="Menu for objects to be added according to
-                   containment constraints"
-      interface="zope.app.publisher.interfaces.browser.AddMenu"
-      />
-
-  <menu
-      id="add_component"
-      title="Add"
-      description="Menu of objects to be added to site management folders"
-      />
-
-  <menu
-      id="add_registration"
-      title="Add Registration"
-      description="Menu of addable configuration objects"
-      />
-
-</configure>

Deleted: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/meta.zcml
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/meta.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/meta.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -1,18 +0,0 @@
-<configure xmlns="http://namespaces.zope.org/zope">
-
-<!-- Standard configuration directives -->
-
-<!-- BBB deprecated as of 2006/02/24. To be removed after 12 months. -->
-<include package="zope.modulealias" file="meta.zcml" />
-
-<include package="zope.app.component" file="meta.zcml" />
-<include package="zope.app.component.browser" file="meta.zcml" />
-<include package="zope.app.publisher" file="meta.zcml" />
-<include package="zope.app.security" file="meta.zcml" />
-<include package="zope.app.form.browser" file="meta.zcml" />
-<include package="zope.i18n" file="meta.zcml" />
-<include package="zope.app.pagetemplate" file="meta.zcml" />
-<include package="zope.app.schema" file="meta.zcml" />
-<include package="zope.app.container.browser" file="meta.zcml" />
-
-</configure>

Added: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/__init__.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/__init__.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/__init__.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -0,0 +1 @@
+# make this directory a package


Property changes on: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/browser.zcml (from rev 71640, Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/browser.zcml)

Copied: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/configure.zcml (from rev 71640, Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml)
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/configure.zcml	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/configure.zcml	2006-12-21 06:21:51 UTC (rev 71641)
@@ -0,0 +1,83 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:i18n="http://namespaces.zope.org/i18n"
+    i18n_domain="zope"
+    >
+
+  <!-- Meta configuration (new directives) -->
+  <include file="meta.zcml" />
+
+  <!-- Note that we need to do this early, as later startup
+       subscribers may break without fixups -->
+
+  <include package="zope.app.component" />
+
+  <include package="zope.app.generations" file="subscriber.zcml" />
+
+  <!-- Ordinary Application (non-view) configuration) -->
+  <include package="zope.app.interface" />
+  <include package="zope.app.security" />
+  <include package="zope.component" />
+  <include package="zope.annotation" />
+  <include package="zope.app.dependable" />
+  <include package="zope.app.content" />
+  <include package="zope.publisher" />
+
+  <include file="menus.zcml" />
+
+  <include package="zope.copypastemove" />
+  <include package="zope.size" />
+  <include package="zope.location" />
+  <include package="zope.app.container" />
+
+  <include package="zope.app.publisher" />
+
+  <include package="zope.app.publication" file="meta.zcml" />
+  <include package="zope.app.publication" />
+
+
+  <include package="zope.traversing" />
+  <include package="zope.app.pagetemplate" />
+  <include package="zope.app.generations" />
+  <include package="zope.app.zapi" />
+
+  <!-- Views -->
+  <include package="zope.app.http" />
+
+  <!-- Translations -->
+  <i18n:registerTranslations directory="../locales" />
+
+  <include package="zope.app.i18n" />
+
+  <!-- Database boostrapping and maintanance -->
+  <include package="zope.app.appsetup" />
+  <include package="zope.app.zopeappgenerations" />
+
+  <!-- Services -->
+  <include package="zope.app.principalannotation" />
+
+  <!-- Utilities -->
+  <include package="zope.app.error" />
+
+  <!-- Broken-object support -->
+  <include package="zope.app.broken" />
+
+  <!-- Skins -->
+
+  <include package="zope.app.basicskin" />
+  <include package="zope.app.rotterdam" />
+
+  <!-- Additional packages -->
+
+  <include package="zope.app.applicationcontrol" />
+  <include package="zope.dublincore" />
+  <include package="zope.app.wsgi" />
+
+
+  <!-- Content types -->
+  <include package="zope.app.folder" />
+
+  <!-- Browser Configurations -->
+  <include file="browser.zcml" />
+
+</configure>

Copied: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/ftesting.zcml (from rev 71640, Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/ftesting.zcml)

Copied: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/menus.zcml (from rev 71640, Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/menus.zcml)

Copied: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/zcmlfiles/meta.zcml (from rev 71640, Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/app/meta.zcml)

Modified: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/tests/test_xmlconfig.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/tests/test_xmlconfig.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/tests/test_xmlconfig.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -271,6 +271,31 @@
     ['tests/samplepackage/foo.zcml.in']
     """
 
+def test_include_of_zope_app():
+    """
+    >>> context = config.ConfigurationMachine()
+    >>> xmlconfig.registerCommonDirectives(context)
+    >>> import zope.app
+
+    >>> import warnings
+    >>> showwarning = warnings.showwarning
+    >>> warnings.showwarning = lambda *a, **k: None
+
+    >>> xmlconfig.include(context, package=zope.app)
+
+    >>> xmlconfig.include(context, 'configure.zcml', zope.app)
+    >>> xmlconfig.include(context, 'ftesting.zcml', zope.app)
+    >>> xmlconfig.include(context, 'menus.zcml', zope.app)
+    >>> xmlconfig.include(context, 'meta.zcml', zope.app)
+    >>> try:
+    ...     xmlconfig.include(context, 'file_not_exists.zcml', zope.app)
+    ... except IOError, msg:
+    ...     'OK'
+    'OK'
+
+    >>> warnings.showwarning = showwarning
+    """
+
 def test_include_by_file_glob():
     """
     >>> context = config.ConfigurationMachine()

Modified: Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/xmlconfig.py
===================================================================
--- Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/xmlconfig.py	2006-12-21 00:07:40 UTC (rev 71640)
+++ Zope3/branches/baijum-zope-app-zcmlfiles/src/zope/configuration/xmlconfig.py	2006-12-21 06:21:51 UTC (rev 71641)
@@ -496,6 +496,20 @@
     elif not file:
         file = 'configure.zcml'
 
+    # BBB 2006/12/19 -- to be removed after 12 months
+    # This is a backward-compatibility support for old site.conf
+
+    if package and (package.__name__ == 'zope.app'):
+        dirpath, filename = os.path.split(file)
+        file = os.path.join(dirpath, "zcmlfiles", filename)
+        import warnings
+        warnings.warn('Change the site.zcml '
+                      'Replace: <include package="zope.app" /> '
+                      'with: <include package="zope.app.zcmlfiles" /> '
+                      "This will go away in Zope 3.6.",
+                      DeprecationWarning,
+                      2)
+
     # This is a tad tricky. We want to behave as a grouping directive.
 
     context = config.GroupingContextDecorator(_context)



More information about the Zope3-Checkins mailing list