Beispiel #1
0
    def monitorDissemination(ctx, requestId):
        # modify the namespace to comply with openwis client service
        try:
            client_ip = ctx.transport.req["HTTP_X_REAL_IP"]
        except KeyError:
            client_ip = ctx.transport.req.get("REMOTE_ADDR")
        LOGGER.info(
            "Received monitorDissemination request for requestId %s from ip %s",
            requestId, client_ip)
        ctx.descriptor.out_message._type_info[
            'disseminationStatus'].Attributes.sub_ns = ""
        host = Notification.get_hostname(client_ip)
        status, message = Database.get_diss_status(requestId + host)
        LOGGER.info("Status for for requestId %s is %s with message %s",
                    requestId + host, status, message)
        # there is a character limit for the message
        # so we truncate
        message = message[:MSG_MAX_LENGTH]
        diss_resp = DisseminationStatus(requestId, status, message)

        return diss_resp