from lovely.remotetask.interfaces import ITaskService
import zeit.cms.generation
import zeit.cms.generation.install
import zope.component


def update(root):
    site_manager = zope.component.getSiteManager()
    for name, _ in site_manager.getUtilitiesFor(ITaskService):
        done = site_manager.unregisterUtility(provided=ITaskService, name=name)
        if not done:
            raise RuntimeError('unregisterUtility did not return True')


def evolve(context):
    zeit.cms.generation.do_evolve(context, update)

from lovely.remotetask.interfaces import ITaskService
import zeit.cms.generation
import zeit.cms.generation.install
import zope.component


def update(root):
    site_manager = zope.component.getSiteManager()
    for name, service in site_manager.getUtilitiesFor(ITaskService):
        done = site_manager.unregisterUtility(provided=ITaskService, name=name)
        if not done:
            raise RuntimeError('unregisterUtility did not return True')
        del service.__parent__[service.__name__]


def evolve(context):
    """Remove the lovely.remotetask services."""
    zeit.cms.generation.do_evolve(context, update)

Remove services and jobs from ZODB, too.
ZON-3514: Remove services and jobs from ZODB, too.

  from lovely.remotetask.interfaces import ITaskService
  import zeit.cms.generation
  import zeit.cms.generation.install
  import zope.component
  
  
  def update(root):
      site_manager = zope.component.getSiteManager()
-     for name, _ in site_manager.getUtilitiesFor(ITaskService):
+     for name, service in site_manager.getUtilitiesFor(ITaskService):
          done = site_manager.unregisterUtility(provided=ITaskService, name=name)
          if not done:
              raise RuntimeError('unregisterUtility did not return True')
+         del service.__parent__[service.__name__]
  
  
  def evolve(context):
+     """Remove the lovely.remotetask services."""
      zeit.cms.generation.do_evolve(context, update)
  
Remove services and jobs from ZODB, too.
## Code Before:
from lovely.remotetask.interfaces import ITaskService
import zeit.cms.generation
import zeit.cms.generation.install
import zope.component


def update(root):
    site_manager = zope.component.getSiteManager()
    for name, _ in site_manager.getUtilitiesFor(ITaskService):
        done = site_manager.unregisterUtility(provided=ITaskService, name=name)
        if not done:
            raise RuntimeError('unregisterUtility did not return True')


def evolve(context):
    zeit.cms.generation.do_evolve(context, update)

## Instruction:
Remove services and jobs from ZODB, too.
## Code After:
from lovely.remotetask.interfaces import ITaskService
import zeit.cms.generation
import zeit.cms.generation.install
import zope.component


def update(root):
    site_manager = zope.component.getSiteManager()
    for name, service in site_manager.getUtilitiesFor(ITaskService):
        done = site_manager.unregisterUtility(provided=ITaskService, name=name)
        if not done:
            raise RuntimeError('unregisterUtility did not return True')
        del service.__parent__[service.__name__]


def evolve(context):
    """Remove the lovely.remotetask services."""
    zeit.cms.generation.do_evolve(context, update)
