[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ First generation of the ZODB for Zope 3.1.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Dec 8 18:14:58 EST 2004


Log message for revision 28592:
  First generation of the ZODB for Zope 3.1.
  

Changed:
  U   Zope3/trunk/src/zope/app/configure.zcml
  A   Zope3/trunk/src/zope/app/zopeappgenerations/
  A   Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py
  A   Zope3/trunk/src/zope/app/zopeappgenerations/configure.zcml
  A   Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py

-=-
Modified: Zope3/trunk/src/zope/app/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/configure.zcml	2004-12-08 23:14:23 UTC (rev 28591)
+++ Zope3/trunk/src/zope/app/configure.zcml	2004-12-08 23:14:58 UTC (rev 28592)
@@ -67,8 +67,9 @@
   <include package="zope.app.broken" />
 
 
-  <!-- Database boostrapping -->
+  <!-- Database boostrapping and maintanance -->
   <include package=".appsetup" />
+  <include package=".zopeappgenerations" />
 
 
   <!-- Skins -->

Added: Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py	2004-12-08 23:14:23 UTC (rev 28591)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py	2004-12-08 23:14:58 UTC (rev 28592)
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Zope Application Server Generations
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.app.generations.generations import SchemaManager
+from zope.app.publication.zopepublication import ZopePublication
+
+key = 'zope.app.zopeappgenerations'
+
+
+ZopeAppSchemaManager = SchemaManager(
+    minimum_generation=0,
+    generation=1,
+    package_name=key)
+
+
+def getRootFolder(context):
+    return context.connection.root().get(ZopePublication.root_name, None)

Added: Zope3/trunk/src/zope/app/zopeappgenerations/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/configure.zcml	2004-12-08 23:14:23 UTC (rev 28591)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/configure.zcml	2004-12-08 23:14:58 UTC (rev 28592)
@@ -0,0 +1,9 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+<utility
+    name="zope.app" 
+    provides="zope.app.generations.interfaces.ISchemaManager"
+    component=".ZopeAppSchemaManager"
+    />
+
+</configure>

Added: Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py	2004-12-08 23:14:23 UTC (rev 28591)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/evolve1.py	2004-12-08 23:14:58 UTC (rev 28592)
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Evolve the ZODB from Zope X3.0 to a Zope X3.1 compatible format.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.app.zopeappgenerations import getRootFolder
+from zope.app.generations.utility import findObjectsProviding
+from zope.app.registration.interfaces import IComponentRegistration
+from zope.app.site.interfaces import ISite 
+
+generation = 1
+
+def evolve(context):
+    root = getRootFolder(context)
+
+    # Fix up registration `componentPath` --> `component`
+    sites = findObjectsProviding(root, ISite)
+    for site in sites:
+        registrations = findObjectsProviding(site.getSiteManager(),
+                                             IComponentRegistration)
+        for reg in registrations:
+            if reg._BBB_componentPath is not None:
+                reg.component = reg.getComponent()



More information about the Zope3-Checkins mailing list