Пример #1
0
    def process(self, path):
        if not path.endswith(".egg"):
            self.logger.info("Ignoring entry %s (not an .egg file)", path)
            return

        self.logger.info("Processing '%s'", path)
        with open(path, "rb") as stream:
            if validate_egg(stream):
                singleton_server = self.app_context.get_object("singleton_server")
                self.importer.import_services(path, singleton_server)
            else:
                self.logger.info("Ingoring entry '%s' (stinky egg)", path)
Пример #2
0
    def process(self, event):
        self.logger.debug("IN_MODIFY event %r" % event)
        self.logger.log(TRACE1, "event.name %s" % event.name)

        if not event.name.endswith(".egg"):
            self.logger.info("Ignoring event %s (not an .egg file)" % event.name)
            return
        else:
            # TODO: Well, at some point we'll have to start accepting .py files
            # and turn them automatically into .eggs.
            pass

        stream = open(os.path.join(self.pickup_dir, event.name), "rb")
        try:
            if validate_egg(stream):
                singleton_server = self.app_context.get_object("singleton_server")
                self.importer.import_services(event.name, singleton_server)
            else:
                self.logger.info("Ignoring event %s" % event.name)
        finally:
            stream.close()