[Checkins] SVN: Products.SQLAlchemyDA/trunk/da.py unregister
utility code for Zope 2.8
Andreas Jung
andreas at andreas-jung.com
Sat Jun 9 06:33:59 EDT 2007
Log message for revision 76532:
unregister utility code for Zope 2.8
Changed:
U Products.SQLAlchemyDA/trunk/da.py
-=-
Modified: Products.SQLAlchemyDA/trunk/da.py
===================================================================
--- Products.SQLAlchemyDA/trunk/da.py 2007-06-09 09:45:25 UTC (rev 76531)
+++ Products.SQLAlchemyDA/trunk/da.py 2007-06-09 10:33:59 UTC (rev 76532)
@@ -19,6 +19,7 @@
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from z3c.sqlalchemy import getSAWrapper, createSAWrapper
+from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
LOG = logging.getLogger('SQLAlchemyDA')
@@ -273,14 +274,21 @@
""" Intercept changed properties in order to perform
further actions.
"""
- if REQUEST.get('dsn') != self.dsn:
- try:
- from zope.component import unregisterUtility
- unregisterUtility(name=self.util_id)
- except ImportError:
- self._new_utilid()
- return PropertyManager.manage_editProperties(self, REQUEST)
+ try:
+ # zope 2.10
+ from zope.component import unregisterUtility
+ unregisterUtility(name=self.util_id)
+ self._new_utilid()
+ except ImportError:
+ # zope 2.8
+ from zope.component.servicenames import Utilities
+ from zope.app import zapi
+ s = zapi.getGlobalServices().getService(Utilities)
+ s.register((), ISQLAlchemyWrapper, self.util_id, None)
+ self._new_utilid()
+
+ return super(SAWrapper, self).manage_editProperties(REQUEST)
manage_workspace = PageTemplateFile('pt/info',
More information about the Checkins
mailing list