def install(portal): setup_tool = getToolByName(portal, 'portal_setup') setup_tool.runAllImportStepsFromProfile('profile-collective.logbook:default') # install monkey install_monkey() LOGGER.info("*** INSTALLED collective.logbook ***") return "Ran all import steps."
def applyChanges(self, data): super(LogbookControlPanelForm, self).applyChanges(data) log("LogbookControlPanelForm::applyChanges:data=%r" % data) logbook_enabled = data.get("logbook_enabled") if logbook_enabled: install_monkey() else: uninstall_monkey()
def initialize(context): """Initializer called when used as a Zope 2 product. """ # Note: Component Registry is not ready at this stage, so we can not query # the Plone registry to see if logbook logging is enabled or not. # # => Install the monkeypatch always. The patched raising event will # check later the Plone registry and will uninstall the monkey # patch if logging is disabled (see monkey.py). monkey.install_monkey()
def initialize(context): """ Initializer called when used as a Zope 2 product. """ from Zope2 import bobo_application app = bobo_application() enabled = app is not None and app.getProperty("logbook_enabled", False) if enabled: monkey.install_monkey() LOGGER.info(">>> logging **enabled**") else: LOGGER.info(">>> logging **disabled**")
def set(self, value): if value: install_monkey() else: uninstall_monkey() if not self.app.hasProperty(PROP_KEY_LOG_ENABLED): self.app.manage_addProperty(PROP_KEY_LOG_ENABLED, value, 'boolean') else: mapping = {} mapping[PROP_KEY_LOG_ENABLED] = value self.app.manage_changeProperties(**mapping)
def initialize(context): """ Initializer called when used as a Zope 2 product. """ # The registry isn't available at that time, so for # now assume it's always enabled. #registry = getUtility(IRegistry) #enabled = registry.get('logbook.logbook_enabled') enabled = True if enabled: monkey.install_monkey() LOGGER.info(">>> logging **enabled**") else: LOGGER.info(">>> logging **disabled**")