def _recreate(self): """.""" try: from zope.component import unregisterUtility unregisterUtility(name=self.util_id) self._new_utilid() except ImportError: try: from zope.app import zapi from zope.component.servicenames import Utilities s = zapi.getGlobalServices().getService(Utilities) s.register((), ISQLAlchemyWrapper, self.util_id, None) self._new_utilid() except Exception: self._new_utilid()
def manage_editProperties(self, REQUEST): """ Intercept changed properties in order to perform further actions. """ try: # zope 2.10 from zope.component import unregisterUtility unregisterUtility(name=self.util_id) self._new_utilid() except ImportError: try: # 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() except Exception: # Zope 2.9 ATT: fix this self._new_utilid() return super(SAWrapper, self).manage_editProperties(REQUEST)