Re: [Demexp-dev] Re: Add response: erreur pyhton
Hello Lyu, 2008/3/11, Lyu Abe <[EMAIL PROTECTED]>: > this_question = s.question_info(cookie, index, 1) > marshalled_qu = marshal.dumps(this_question[0]['q_id']) > marshalled_resp = marshal.dumps(new_response) > s.add_response(cookie, marshalled_qu,marshalled_resp,"") Well, I don't really understand why you would need such marshal calls. If you look at the code of the XML RPC proxy, you see for example this code to add a new response (line 157): def add_response(self, cookie, question_id, response_desc, response_link): ret = self.onc.add_response(cookie, question_id, response_desc.encode('utf_8'), response_link.encode('utf_8')) if ret != DemexpRpc.const.rt_ok: raise RpcError(ret) return ret "cookie" is the cookie you got from login(). "question_id" is a Python integer. "response_desc" and "response_link" are two Python strings. When you use ONC RPC calls, you can use regular Python simple types as arguments. Where are those marshal calls coming from? You'll find other examples of Python code to call the demexp server in the source code of pydemexp (http://thomas.enix.org/pub/pydemexp/), in files "add-question.py" and "list-question.py". If you are able to get your new response as a regular Python string, you should be able to add it to the server pretty easily. I hope this helps, Yours, d. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
Re: [Demexp-dev] Timestamps (de)compression?
2008/3/11, Lyu Abe <[EMAIL PROTECTED]>: I try to decode compressed timestamps. I tried to use the decompress function from the zlib module in mod python, but it does not seem to give satifactory results (undecipherable strings). Any hint? Yes. Look at get_timestamps_decoded() in the source code of the Python XML RPC proxy, especially the function __as_int_array() (lines 132-147): http://www.linux-france.org/cgi-bin/hgwebdir.cgi/demexp/xmlrpc-proxy?f=2c37f5f19621;file=demexp-xmlrpc-proxy.py Yes! :D Lyu Yours, d. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
Re: [Demexp-dev] Re: Add response: erreur pyhton
My code looks like that: def validate_new_response(req): global question_list global question_tags global tag_labels global cookie global s global login args = req.form index = int(args['qu_num']) new_response = args['new_response'] ... this_question = s.question_info(cookie, index, 1) marshalled_qu = marshal.dumps(this_question[0]['q_id']) marshalled_resp = marshal.dumps(new_response) s.add_response(cookie, marshalled_qu,marshalled_resp,"") then I get the server error. I think the "dumps" function I use is not appropriate. Lyu David MENTRE a écrit : Hello Lyu, 2008/3/11, Lyu Abe <[EMAIL PROTECTED]>: I succeeded in using the "marshal" module so that I don't get the error below anymore. However, I get an "Internal server error" from the request. If you get an "internal server error", then the fault is on the side of the demexp server. However I need more details to find what is happening. Can you provide a self-contained Python code that exhibits the issue? Can I add new answers and new questions with the "demo" account? I think so. But you should use the "test" server (tuxinette.linux-france.org:50065). I've just checked: you can add new questions with the account "demo", password "demo". Yours, d. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
Re: [Demexp-dev] Re: Add response: erreur pyhton
Hello Lyu, 2008/3/11, Lyu Abe <[EMAIL PROTECTED]>: > I succeeded in using the "marshal" module so that I don't get the error > below anymore. However, I get an "Internal server error" from the > request. If you get an "internal server error", then the fault is on the side of the demexp server. However I need more details to find what is happening. Can you provide a self-contained Python code that exhibits the issue? > Can I add new answers and new questions with the "demo" account? I think so. But you should use the "test" server (tuxinette.linux-france.org:50065). I've just checked: you can add new questions with the account "demo", password "demo". Yours, d. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
Re: [Demexp-dev] Timestamps (de)compression?
Hello Lyu, 2008/3/11, Lyu Abe <[EMAIL PROTECTED]>: > I try to decode compressed timestamps. I tried to use the decompress > function from the zlib module in mod python, but it does not seem to > give satifactory results (undecipherable strings). Any hint? Yes. Look at get_timestamps_decoded() in the source code of the Python XML RPC proxy, especially the function __as_int_array() (lines 132-147): http://www.linux-france.org/cgi-bin/hgwebdir.cgi/demexp/xmlrpc-proxy?f=2c37f5f19621;file=demexp-xmlrpc-proxy.py Yours, d. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
[Demexp-dev] Timestamps (de)compression?
Hi, I try to decode compressed timestamps. I tried to use the decompress function from the zlib module in mod python, but it does not seem to give satifactory results (undecipherable strings). Any hint? Regards, Lyu ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
[Demexp-dev] Re: Add response: erreur pyhton
Hi there, I succeeded in using the "marshal" module so that I don't get the error below anymore. However, I get an "Internal server error" from the request. Can I add new answers and new questions with the "demo" account? Best Regards. Lyu Bonjour, j'essaye d'appeler la fonction add_response(cookie,quetsion_id,response_desc_t,link_t) et j'obtiens l'erreur suivante sous mod python: File "C:\Program Files\wamp\www\Demexp\python\login.py", line 248, in validate_new_response s.add_response(cookie, this_question[0]['q_id'],new_response,"") ... File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 633, in __dump raise TypeError, "cannot marshal %s objects" % type(value) TypeError: cannot marshal objects Qu'est-ce que ca vous inspire? Merci. Lyu PS: j'ai implemente la fonction de vote. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev
[Demexp-dev] Test
This is a test. ___ Demexp-dev mailing list Demexp-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/demexp-dev