Example #1
0
    def unloadWebApp(self, vhost, web):
        webapp = self.allWebApps[(vhost, web)]
        name = os.path.split(webapp.getFileSystemPath())[1]
        modulename = "webapps." + name

        # count instances of the web app that we're going to unload...
        instances = [
            wapp for wapp in self.allWebApps.values()
            if wapp.getName() == webapp.getName()
        ]
        if len(instances) > 1:
            return False
        del instances

        for n in sys.modules.keys()[:]:
            if n.startswith(modulename) and type(
                    sys.modules[n]) is types.ModuleType:
                del sys.modules[n]

        if webapp in self.virtualHosts[vhost]:
            self.virtualHosts[vhost].remove(webapp)
        if vhost in self.webRoots and self.webRoots[vhost] is webapp:
            del self.webRoots[vhost]
        try:
            webapp.close()
        except Exception, x:
            log.warn("error during unload: %s", x)
Example #2
0
 def server_close(self):
     self.socket.close()  # stop accepting requests
     print "Closing down webapps..."
     log.info("Closing down webapps...")
     for webapp in self.allWebApps.values():
         log.debug("closing %s", webapp)
         try:
             webapp.close()
         except Exception, x:
             log.warn("Error during closing: %s", x)
             import traceback
             log.warn("".join(traceback.format_exception(*sys.exc_info())))
Example #3
0
 def server_close(self):
     self.socket.close()         # stop accepting requests
     print "Closing down webapps..."
     log.info("Closing down webapps...")
     for webapp in self.allWebApps.values():
         log.debug("closing %s",webapp)
         try:
             webapp.close()
         except Exception,x:
             log.warn("Error during closing: %s",x)
             import traceback
             log.warn( "".join(traceback.format_exception(*sys.exc_info())) )
Example #4
0
    def unloadWebApp(self, vhost, web):
        webapp=self.allWebApps[(vhost,web)]
        name=os.path.split(webapp.getFileSystemPath())[1]
        modulename="webapps."+name
        
        # count instances of the web app that we're going to unload...
        instances = [wapp for wapp in self.allWebApps.values() if wapp.getName()==webapp.getName() ]
        if len(instances)>1:
            return False
        del instances
    
        for n in sys.modules.keys()[:]:
            if n.startswith(modulename) and type(sys.modules[n]) is types.ModuleType:
                del sys.modules[n]

        if webapp in self.virtualHosts[vhost]:
            self.virtualHosts[vhost].remove(webapp)
        if vhost in self.webRoots and self.webRoots[vhost] is webapp:
            del self.webRoots[vhost]
        try:
            webapp.close()
        except Exception,x:
            log.warn("error during unload: %s",x)