[Zope3-checkins] CVS: Zope3/src/zope/app/services - adapter.py:1.22.6.2 configure.zcml:1.57.6.3 presentation.py:1.1.2.2 service.py:1.30.6.3

Jim Fulton cvs-admin at zope.org
Thu Nov 20 16:13:58 EST 2003


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

Modified Files:
      Tag: adaptergeddon-branch
	adapter.py configure.zcml presentation.py service.py 
Log Message:
Added Backward compatability support.


=== Zope3/src/zope/app/services/adapter.py 1.22.6.1 => 1.22.6.2 ===
--- Zope3/src/zope/app/services/adapter.py:1.22.6.1	Tue Nov 18 17:26:35 2003
+++ Zope3/src/zope/app/services/adapter.py	Thu Nov 20 16:13:57 2003
@@ -114,3 +114,17 @@
 
 # XXX Pickle backward compatability
 AdapterConfiguration = AdapterRegistration
+
+
+#BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+
+import persistence
+from zope.interface.surrogate import ReadProperty
+
+AdapterRegistration.required = ReadProperty(lambda self: self.forInterface)
+AdapterRegistration.provided = ReadProperty(
+    lambda self: self.providedInterface)
+AdapterRegistration.name     = ReadProperty(lambda self: self.adapterName)
+
+class AdapterService(persistence.Persistent):
+    pass


=== Zope3/src/zope/app/services/configure.zcml 1.57.6.2 => 1.57.6.3 ===
--- Zope3/src/zope/app/services/configure.zcml:1.57.6.2	Tue Nov 18 17:26:35 2003
+++ Zope3/src/zope/app/services/configure.zcml	Thu Nov 20 16:13:57 2003
@@ -52,7 +52,7 @@
   <require
       permission="zope.ManageServices"
       interface=".adapter.IAdapterRegistration"
-      set_schema="zope.app.interfaces.services.registration.IRegistration"
+      set_schema=".adapter.IAdapterRegistration"
       />
   <require
       permission="zope.ManageServices"


=== Zope3/src/zope/app/services/presentation.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/services/presentation.py:1.1.2.1	Tue Nov 18 17:34:42 2003
+++ Zope3/src/zope/app/services/presentation.py	Thu Nov 20 16:13:57 2003
@@ -418,7 +418,6 @@
         self.attribute = attribute
 
     def implementationSummary(self):
-        import pdb; pdb.set_trace()
         L = []
         if self.template:
             prefix = "/++etc++site/"
@@ -513,3 +512,26 @@
         if not template_usage:
             kw["template_usage"] = template_usage
         return self.template.render(self.view, *args, **kw)
+
+#BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+
+from zope.app.event.function import Subscriber
+import persistence
+import sys
+from zope.interface.surrogate import ReadProperty
+
+ViewRegistration.required    = ReadProperty(lambda self: self.forInterface)
+ViewRegistration.factoryName = ReadProperty(lambda self: self.class_)
+ViewRegistration.name        = ReadProperty(lambda self: self.viewName)
+
+class ViewService(persistence.Persistent):
+    pass
+
+def fixup(event):
+    # We delay this evil hackery until database open to prevent someone
+    # successfully importing IBrowserPresentation through a normal import
+    sys.modules['zope.app.services.view'] = sys.modules[__name__]
+    IBrowserRequest = zope.publisher.interfaces.browser.IBrowserRequest
+    zope.publisher.interfaces.browser.IBrowserPresentation = IBrowserRequest 
+    
+fixup = Subscriber(fixup)


=== Zope3/src/zope/app/services/service.py 1.30.6.2 => 1.30.6.3 ===
--- Zope3/src/zope/app/services/service.py:1.30.6.2	Tue Nov 11 13:44:05 2003
+++ Zope3/src/zope/app/services/service.py	Thu Nov 20 16:13:57 2003
@@ -303,3 +303,53 @@
     def extra(self):
         obj = removeAllProxies(self.context)
         return AttrMapping(obj, _smattrs)
+
+#BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+
+
+
+from zope.app.event.function import Subscriber
+from transaction import get_transaction
+from zope.component.exceptions import ComponentLookupError
+from zope.app.interfaces.services.service import IPossibleSite
+
+def fixup(event):
+    database = event.database
+    connection = database.open()
+    app = connection.root().get('Application')
+    if app is None:
+        # no old site
+        return
+
+    try:
+        sm = app.getSiteManager()
+    except ComponentLookupError:
+        # no old site
+        return
+
+    if hasattr(sm, 'next'):
+        # already done
+        return
+    
+    print "Fixing up sites that don't have next pointers"
+    fixfolder(app)
+    get_transaction().commit()
+    connection.close()
+    
+fixup = Subscriber(fixup)
+
+def fixfolder(folder):
+    try:
+        sm = folder.getSiteManager()
+    except ComponentLookupError:
+        pass # nothing to do
+    else:
+        sm._setNext(folder)
+        sm.subSites = ()
+        for name in ('Views', 'Adapters'):
+            if name in sm._bindings:
+                del sm._bindings[name]
+
+    for item in folder.values():
+        if IPossibleSite.isImplementedBy(item):
+            fixfolder(item)




More information about the Zope3-Checkins mailing list