[Zope3-checkins] CVS: Zope3/src/zope/app/container - contained.py:1.20

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Mar 13 23:04:01 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv28004/src/zope/app/container

Modified Files:
	contained.py 
Log Message:
Remove backward-compatibility fixups. They were all way older than 2 months
and backward.zcml was not included anyways. It is not included though.


=== Zope3/src/zope/app/container/contained.py 1.19 => 1.20 ===
--- Zope3/src/zope/app/container/contained.py:1.19	Sat Mar 13 18:54:58 2004
+++ Zope3/src/zope/app/container/contained.py	Sat Mar 13 23:03:30 2004
@@ -719,98 +719,4 @@
     __Security_checker__ = DecoratedSecurityCheckerDescriptor()
 
 
-##############################################################################
-# Parentgeddon fixup:
-
-from zope.app.event.function import Subscriber
-from zope.app.folder.interfaces import IRootFolder
-from zope.app.container.interfaces import IWriteContainer
-from zope.app.site.interfaces import IPossibleSite, ISiteManager
-from zope.app.container.interfaces import IContainer
-from transaction import get_transaction
-from zope.component.exceptions import ComponentLookupError
-from zope.app.registration.interfaces import IRegistry
-from zope.app.registration.registration import RegistrationStack
-
-def parentgeddonFixup(event):
-    """Fixup databases to work with the result of parentgeddon.
-    """
-
-    database = event.database
-    connection = database.open()
-    app = connection.root().get('Application')
-    if app is None:
-        # No old data
-        return
-
-    if IRootFolder.providedBy(app):
-        # already did fixup
-        return
-
-    print "Fixing up data for parentgeddon"
-
-    zope.interface.directlyProvides(
-        app, IRootFolder,
-        zope.interface.directlyProvidedBy(app))
-
-    global fixing_up
-    fixing_up = True
-
-    try:
-        fixcontainer(app)
-        get_transaction().commit()
-    finally:
-        get_transaction().abort()
-        fixing_up = False
-        connection.close()
-
-parentgeddonFixup = Subscriber(parentgeddonFixup)
-
-def fixcontainer(container):
-
-    # Step 1: fix items:
-    for name in container:
-        ob = container[name]
-
-        if not IContained.providedBy(ob):
-            # remove the old item and reassign it
-            del container[name]
-            ob = contained(ob, container, name)
-            container[name] = ob
-        elif ob.__parent__ is not container:
-            ob.__parent__ = container
-            ob.__name__ = name
-
-        if IContainer.providedBy(ob):
-            fixcontainer(ob)
-
-        if IRegistry.providedBy(ob):
-            fixregistry(ob)
-
-    if IPossibleSite.providedBy(container):
-        try:
-            sm = container.getSiteManager()
-        except ComponentLookupError:
-            pass # nothing to do
-        else:
-            fixupsitemanager(sm, container)
-
-def fixupsitemanager(sm, container):
-    sm.__parent__ = container
-    sm.__name__ = '++etc++site'
-    sm._SampleContainer__data = sm.Packages._SampleContainer__data
-    del sm.Packages
-    fixregistry(sm)
-    fixcontainer(sm)
-
-def fixregistry(registry):
-    if ISiteManager.providedBy(registry):
-        for name in registry.listRegistrationNames():
-            stack = registry.queryRegistrations(name)
-            stack.__parent__ = registry
-        return
-    for data in registry.getRegisteredMatching():
-        for ob in data:
-            if isinstance(ob, RegistrationStack):
-                ob.__parent__ = registry
 




More information about the Zope3-Checkins mailing list