コード例 #1
0
ファイル: client.py プロジェクト: pombredanne/syndicate
    def __call__(self, *args, **kw):
        # parse arguments.
        # use lib to load and store temporary data for the argument parsers.
        lib = conf.ArgLib()
        lib.config = self.config
        lib.username = self.config["username"]

        args, kw, extras = conf.parse_args(self.config, self.method_name, args, kw, lib)

        # validate arguments
        valid = conf.validate_args(self.method_name, args, kw)
        if not valid:
            raise Exception("Invalid arguments for %s" % self.method_name)

        return call_method(self.config, self.client, self.method_name, args, kw)
コード例 #2
0
        verify_reply = config["verify_reply"]

    # parse arguments.
    # use lib to load and store temporary data for the argument parsers.
    lib = conf.ArgLib()
    lib.config = config

    try:
        args, kw, extras = conf.parse_args(config, method_name, args, kw, lib)
    except Exception, e:
        log.exception(e)
        log.error("Failed to parse arguments for '%s'" % method_name)
        raise e

    # make sure we got the right number of arguments
    valid = conf.validate_args(method_name, args, kw)
    if not valid:
        raise Exception("Invalid arguments for %s" % method_name)

    method_callable = getattr(proxy, method_name)

    # NOTE: might cause an exception
    log.debug(
        "As %s, call %s(%s %s)"
        % (
            proxy.caller_username,
            method_name,
            ", ".join(map(lambda x: x[:50] + "..." if len(x) > 50 else x, [str(a) for a in args])),
            ", ".join(
                map(lambda x: x[:50] + "..." if len(x) > 50 else x, ["%s=%s" % (str(k), str(kw[k])) for k in kw.keys()])
            ),
コード例 #3
0
ファイル: client.py プロジェクト: iychoi/syndicate-core
        verify_reply = config['verify_reply']

    # parse arguments.
    # use lib to load and store temporary data for the argument parsers.
    lib = conf.ArgLib()
    lib.config = config

    try:
        args, kw, extras = conf.parse_args(config, method_name, args, kw, lib)
    except Exception, e:
        log.exception(e)
        log.error("Failed to parse arguments for '%s'" % method_name)
        raise e

    # make sure we got the right number of arguments
    valid = conf.validate_args(method_name, args, kw)
    if not valid:
        raise Exception("Invalid arguments for %s" % method_name)

    method_callable = getattr(proxy, method_name)

    # NOTE: might cause an exception
    log.debug(
        "As %s, call %s(%s %s)" %
        (proxy.caller_username, method_name, ", ".join(
            map(lambda x: x[:50] + "..."
                if len(x) > 50 else x, [str(a) for a in args])), ", ".join(
                    map(lambda x: x[:50] + "..." if len(x) > 50 else x,
                        ["%s=%s" % (str(k), str(kw[k])) for k in kw.keys()]))))

    ret = method_callable(*args, **kw)