def _findNextSiteManager(site): while True: if IContainmentRoot.providedBy(site): # we're the root site, return None return None try: site = zapi.getParent(site) except TypeError: # there was not enough context; probably run from a test return None if interfaces.ISite.providedBy(site): return site.getSiteManager()
def changeSiteConfigurationAfterMove(site, event): """After a site is moved, its site manager links have to be updated.""" next = None if event.newParent is not None: next = _findNextSiteManager(site) site.getSiteManager().setNext(next)