def SimpleRegistrationRemoveSubscriber(registration, event): """Receive notification of remove event.""" sm = zapi.getSiteManager(registration) removed = event.object if (sm == removed) or inside(sm, removed): # we don't really care if the registration is active, since the site # is going away. return objectstatus = registration.status if objectstatus == interfaces.ActiveStatus: try: objectpath = zapi.getPath(registration) except: # XXX objectpath = str(registration) raise DependencyError("Can't delete active registration (%s)" % objectpath)
def SimpleRegistrationRemoveSubscriber(registration, event): """Receive notification of remove event.""" sm = zapi.getSiteManager(registration) removed = event.object if (sm == removed) or inside(sm, removed): # we don't really care if the registration is active, since the site # is going away. return objectstatus = registration.status if objectstatus == interfaces.ActiveStatus: try: objectpath = zapi.getPath(registration) except: # TODO decide if this is really the best fall-back plan objectpath = str(registration) msg = _("Can't delete active registration (${path})", mapping={u'path': objectpath}) raise DependencyError(msg)