[Checkins] SVN: lovely.remotetask/branches/port-for-zope210/src/lovely/remotetask/__init__.py fix weird site problem in Zope2 initialize code....hm, right, all zope2 tweaks here are weird...

Radim Novotny novotny.radim at gmail.com
Wed Sep 9 13:24:02 EDT 2009


Log message for revision 103694:
  fix weird site problem  in Zope2  initialize code....hm, right, all zope2 tweaks here are weird...

Changed:
  U   lovely.remotetask/branches/port-for-zope210/src/lovely/remotetask/__init__.py

-=-
Modified: lovely.remotetask/branches/port-for-zope210/src/lovely/remotetask/__init__.py
===================================================================
--- lovely.remotetask/branches/port-for-zope210/src/lovely/remotetask/__init__.py	2009-09-09 15:52:01 UTC (rev 103693)
+++ lovely.remotetask/branches/port-for-zope210/src/lovely/remotetask/__init__.py	2009-09-09 17:24:02 UTC (rev 103694)
@@ -11,21 +11,23 @@
 if ZOPE2:
     from lovely.remotetask.service import TaskService, getAutostartServiceNames
     from lovely.remotetask.interfaces import ITaskService
-    from zope.component import getUtilitiesFor
-    from zope.app.component.hooks import getSite
+    from zope.component import ComponentLookupError
+    from zope.app.component.hooks import getSite, setSite
     from Products.CMFCore.interfaces._content import ISiteRoot
 
     def initialize(context):
         # dirty trick, but it works
         app = context._ProductContext__app
         services = getAutostartServiceNames()
-
+        old_site = getSite()
         for service in services:
             site_name, service_name = service.split('@')
             if site_name:
                 site = getattr(app, site_name, None)
                 if site:
                     registry = site.getSiteManager()
-                    service = registry.queryUtility(ITaskService, name=service_name)
+                    setSite(site)  # blah, five/localsitemanager/registry.py ver. 1.1, line 108, in _wrap can't find site.
+                    service = registry.getUtility(ITaskService, name=service_name)
                     if ITaskService.providedBy(service) and not service.isProcessing():
                         service.startProcessing()
+        setSite(old_site)



More information about the checkins mailing list