def remove(self, app): ApplicationFactory.remove(self, app) try: del self.apps_by_domain[app.domain] except KeyError: pass except AttributeError: pass
def __init__(self, inst): ApplicationFactory.__init__(self, inst) self.apps_by_domain = WeakValueDictionary() # to avoid garbage collection self.main_app = self.get_by_tag("main") self.main_host = self.main_app.main_host
def add(self, app): ApplicationFactory.add(self, app) try: self.apps_by_domain[app.domain] = app except AttributeError: pass