[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-08-08 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
stage: unit test needed - committed/rejected
status: pending - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-07-22 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

But what if I want to pass a tuple through xmlrpc?
The function in the test case:
+def execute(server, methodname, *args):
+r = getattr(server, methodname)(args) # params become a tuple
+return r
looks wrong to me. It has the effect to modify the nature of the arguments. 
If I write instead:
+def execute(server, methodname, *args):
+r = getattr(server, methodname)(*args)
+return r
(note the additional '*') the function may receive several arguments, and will 
call the server method with several arguments as well.
Tuple unpacking occurs where tuple packing was made. The library does not need 
to be changed.

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-03-20 Thread Jelly Chen

Jelly Chen sinoje...@gmail.com added the comment:

I know why those two tests run failed, and I found another way to solve the
problem, do not make the existing tests broken, and at the same time I have
added another test case.
I encountered this problem due to a argument is already being a tuple but
re-packaged into another tuple, It appears a high probability. Maybe modify
the client.py according to this patch is a solution.

2010/2/22 Florent Xicluna rep...@bugs.python.org


 Florent Xicluna la...@yahoo.fr added the comment:

 Attached, the output of the test with -v test_xmlrpc.

 --
 Added file: http://bugs.python.org/file16308/issue7977_test_xmlrpc.log

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue7977
 ___


--
Added file: http://bugs.python.org/file16597/unnamed
Added file: http://bugs.python.org/file16598/dir.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___divspan class=Apple-style-span style=font-family: Arial, sans-serif; 
font-size: 13px; line-height: 22px; span 
title=我知道为什么那两个用例运行失败了,并且我找到了另外一个办法去解决问题,不会使得已有的用例运行不过,同时我补充了一个用例。I
 know why those two tests run failed, and I found another way to solve the 
problem, do not make the existing tests broken, and at the same time I have 
added another test case.br
/spanspan 
title=我遇到的问题,是由于已经是一个tuple的参数,被再次封装成一个tuple。I
 encountered this problem due to a argument is already being a tuple but 
re-packaged into another tuple, It appears a high probability. Maybe modify the 
client.py according to this patch is a solution./span/spanbr
brdiv class=gmail_quote2010/2/22 Florent Xicluna span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/spanbrblockquote
 class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1ex;
br
Florent Xicluna lt;a href=mailto:la...@yahoo.fr;la...@yahoo.fr/agt; 
added the comment:br
br
Attached, the output of the test with quot;-v test_xmlrpcquot;.br
br
--br
Added file: a 
href=http://bugs.python.org/file16308/issue7977_test_xmlrpc.log; 
target=_blankhttp://bugs.python.org/file16308/issue7977_test_xmlrpc.log/abr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue7977; 
target=_blankhttp://bugs.python.org/issue7977/agt;br
___br
/div/div/blockquote/divbrbr clear=allbr-- brContact me: 
nbsp;brQQ: 2578717brMSN: a 
href=mailto:sinoje...@msn.cn;sinoje...@msn.cn/abr新浪微博:a 
href=http://t.sina.com.cn/sinojelly;http://t.sina.com.cn/sinojelly/abr
我的博客:a 
href=http://sinojelly.20x.cc;http://sinojelly.20x.cc/abrbrbr
/div
diff -Nur old\test\test_xmlrpc.py new\test\test_xmlrpc.py
--- old\test\test_xmlrpc.py Thu Aug 13 18:30:32 2009
+++ new\test\test_xmlrpc.py Sat Mar 20 19:39:48 2010
@@ -478,6 +478,14 @@
 # This avoids waiting for the socket timeout.
 self.test_simple1()
 
+def test_call_with_tuple_param(self):
+def execute(server, methodname, *args):
+r = getattr(server, methodname)(args) # params become a tuple
+return r
+p = xmlrpclib.ServerProxy(URL)
+r = execute(p, add, 4,7)
+self.assertEqual(r, 11)
+
 # This is a contrived way to make a failure occur on the server side
 # in order to test the _send_traceback_header flag on the server
 class FailingMessageClass(http.client.HTTPMessage):
diff -Nur old\xmlrpc\client.py new\xmlrpc\client.py
--- old\xmlrpc\client.pyThu Jun 04 17:11:52 2009
+++ new\xmlrpc\client.pySat Mar 20 19:41:03 2010
@@ -49,6 +49,7 @@
 # 2003-07-12 gp  Correct marshalling of Faults
 # 2003-10-31 mvl Add multicall support
 # 2004-08-20 mvl Bump minimum supported Python version to 2.1
+# 2010-03-20 cgd Avoid to make a tuple to be another tuple(Chenguodong 
email:sinoje...@gmail.com)
 #
 # Copyright (c) 1999-2002 by Secret Labs AB.
 # Copyright (c) 1999-2002 by Fredrik Lundh.
@@ -1026,6 +1027,9 @@
 def __getattr__(self, name):
 return _Method(self.__send, %s.%s % (self.__name, name))
 def __call__(self, *args):
+# Fixed by sinojelly: if args[0] is a tuple, should not make it to be 
another tuple.
+if len(args) == 1 and type(args[0]) is type(()):
+args = args[0]
 return self.__send(self.__name, args)
 
 ##
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Jelly Chen

Jelly Chen sinoje...@gmail.com added the comment:

I can't modify the issue. so i replay this email.
The old xmlrpc lib don't use param surround a param. please take a look at
wrong.xml and right.xml.

2010/2/22 Mark Dickinson rep...@bugs.python.org


 Mark Dickinson dicki...@gmail.com added the comment:

 Please could you generate and upload a patch against the Python source?
  (For Windows, you can do this using the WinMerge tool, amongst others.)
  I'm unable to open the file you attached on my machine:

 No application knows how to open ... xmlrpc.client.modify.rar.

 If you could explain how param is being used improperly, that might
 also help.

 --
 nosy: +mark.dickinson

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue7977
 ___


--
keywords: +patch
Added file: http://bugs.python.org/file16292/unnamed
Added file: http://bugs.python.org/file16293/xmlrpc.patch
Added file: http://bugs.python.org/file16294/wrong.xml
Added file: http://bugs.python.org/file16295/right.xml

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___I can#39;t modify the issue. so i replay this email.divThe old xmlrpc lib 
don#39;t use lt;paramgt;nbsp;surround a param. please take a look at 
wrong.xml and right.xml.brbrdiv class=gmail_quote2010/2/22 Mark 
Dickinson span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/spanbr
blockquote class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1ex;br
Mark Dickinson lt;a 
href=mailto:dicki...@gmail.com;dicki...@gmail.com/agt; added the 
comment:br
br
Please could you generate and upload a patch against the Python source? 
nbsp;(For Windows, you can do this using the WinMerge tool, amongst others.) 
nbsp;I#39;m unable to open the file you attached on my machine:br
br
quot;quot;quot;No application knows how to open ... 
xmlrpc.client.modify.rar.quot;quot;quot;br
br
If you could explain how quot;lt;paramgt;quot; is being used improperly, 
that might also help.br
br
--br
nosy: +mark.dickinsonbr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue7977; 
target=_blankhttp://bugs.python.org/issue7977/agt;br
___br
/div/div/blockquote/divbrbr clear=allbr-- brContact me: 
nbsp;brQQ: 2578717brMSN: a 
href=mailto:sinoje...@msn.cn;sinoje...@msn.cn/abr新浪微博:a 
href=http://t.sina.com.cn/sinojelly;http://t.sina.com.cn/sinojelly/abr
我的博客:a 
href=http://sinojelly.20x.cc;http://sinojelly.20x.cc/abrbrbr
/div
diff -Nur xmlrpc\client.py modify\xmlrpc\client.py
--- xmlrpc\client.pyThu Jun 04 17:11:52 2009
+++ modify\xmlrpc\client.py Mon Feb 22 19:13:37 2010
@@ -49,6 +49,7 @@
 # 2003-07-12 gp  Correct marshalling of Faults
 # 2003-10-31 mvl Add multicall support
 # 2004-08-20 mvl Bump minimum supported Python version to 2.1
+# 2010-02-22 cgd Reorganize xmlrpc request message format (Chenguodong 
email:sinoje...@gmail.com)
 #
 # Copyright (c) 1999-2002 by Secret Labs AB.
 # Copyright (c) 1999-2002 by Fredrik Lundh.
@@ -508,9 +509,7 @@
 # is for now.  See @XMLRPC3 for more information. /F
 write(params\n)
 for v in values:
-write(param\n)
 dump(v, write)
-write(/param\n)
 write(/params\n)
 result = .join(out)
 return result
@@ -588,13 +587,25 @@
 raise TypeError(cannot marshal recursive sequences)
 self.memo[i] = None
 dump = self.__dump
+for v in value:
+write(param\n)
+dump(v, write)
+write(/param\n)
+del self.memo[i]
+dispatch[tuple] = dump_array
+
+def dump_list(self, value, write):
+i = id(value)
+if i in self.memo:
+raise TypeError(cannot marshal recursive sequences)
+self.memo[i] = None
+dump = self.__dump
 write(valuearraydata\n)
 for v in value:
 dump(v, write)
 write(/data/array/value\n)
 del self.memo[i]
-dispatch[tuple] = dump_array
-dispatch[list] = dump_array
+dispatch[list] = dump_list
 
 def dump_struct(self, value, write, escape=escape):
 i = id(value)
?xml version='1.0'?
methodCall
methodNamemetaWeblog.newPost/methodName
params
param
valuedata
valueint1/int/value
valuestringsinojelly/string/value
valuestring123456/string/value
valuestruct
member
namedescription/name
valuestringTest description4/string/value
/member
member
nametitle/name
valuestringTest article3/string/value
/member
/struct/value
valueboolean1/boolean/value
/data/value
/param
/params
/methodCall
?xml version=1.0 encoding=gb2312?
methodCall
 

[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

The patch causes failures in test_xmlrpc, using Py3k branch.

--
nosy: +flox
priority:  - normal
stage:  - test needed
versions: +Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Jelly Chen

Jelly Chen sinoje...@gmail.com added the comment:

Can i have a look at the failure tests?
I just check out code at http://svn.python.org/projects/python/branches/py3k
It's very slow. and i'm afraid that i don't know how to run the tests.

The param tag use improperly is very clear.

the wrong case: very ugly, there is no difference between param and
params.
params
param
valuedata
valueint1/int/value
valuestringsinojelly/string/value
valuestring123456/string/value
valuestruct
member
namedescription/name
valuestringTest description4/string/value
/member
member
nametitle/name
valuestringTest article3/string/value
/member
/struct/value
valueboolean1/boolean/value
/data/value
/param
/params

the right one: there is a param around every parameter.
 params
  param
   value
string479153/string
   /value
  /param
  param
   value
stringsinojelly/string
   /value
  /param
  param
   value
string123456/string
   /value
  /param
  param
   value
struct
 member
  nametitle/name
  value
   stringJust Test./string
  /value
 /member
 member
  namedescription/name
  value
   stringlt;pgt;Just Test wlw post.lt;/pgt;/string
  /value
 /member
 member
  namecategories/name
  value
   array
data /
   /array
  /value
 /member
/struct
   /value
  /param
  param
   value
boolean1/boolean
   /value
  /param
 /params

2010/2/22 Florent Xicluna rep...@bugs.python.org


 Florent Xicluna la...@yahoo.fr added the comment:

 The patch causes failures in test_xmlrpc, using Py3k branch.

 --
 nosy: +flox
 priority:  - normal
 stage:  - test needed
 versions: +Python 3.2

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue7977
 ___


--
Added file: http://bugs.python.org/file16303/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___Can i have a look at the failure tests?divI just check out code 
atnbsp;span class=Apple-style-span style=font-family: Arial, Verdana, 
Geneva, #39;Bitstream Vera Sans#39;, Helvetica, sans-serif; font-size: 15px; 
line-height: 17px; -webkit-border-horizontal-spacing: 2px; 
-webkit-border-vertical-spacing: 2px; a class=reference external 
href=http://svn.python.org/projects/python/branches/py3k; style=color: rgb(0, 
0, 170); text-decoration: none; 
http://svn.python.org/projects/python/branches/py3k/a/spanbr
It#39;s very slow. and i#39;m afraid that i don#39;t know how to run the 
tests./divdivbr/divdivThe lt;paramgt; tag use improperly is very 
clear./divdivbr/divdivthe wrong case: very ugly, there is no 
difference between lt;paramgt; and lt;paramsgt;./div
divdivlt;paramsgt;/divdivlt;paramgt;/divdivlt;valuegt;lt;datagt;/divdivlt;valuegt;lt;intgt;1lt;/intgt;lt;/valuegt;/divdivlt;valuegt;lt;stringgt;sinojellylt;/stringgt;lt;/valuegt;/div
divlt;valuegt;lt;stringgt;123456lt;/stringgt;lt;/valuegt;/divdivlt;valuegt;lt;structgt;/divdivlt;membergt;/divdivlt;namegt;descriptionlt;/namegt;/divdivlt;valuegt;lt;stringgt;Test
 description4lt;/stringgt;lt;/valuegt;/div
divlt;/membergt;/divdivlt;membergt;/divdivlt;namegt;titlelt;/namegt;/divdivlt;valuegt;lt;stringgt;Test
 
article3lt;/stringgt;lt;/valuegt;/divdivlt;/membergt;/divdivlt;/structgt;lt;/valuegt;/div
divlt;valuegt;lt;booleangt;1lt;/booleangt;lt;/valuegt;/divdivlt;/datagt;lt;/valuegt;/divdivlt;/paramgt;/divdivlt;/paramsgt;/div/divdivbr/divdivthe
 right one: there is a lt;paramgt; around every parameter./div
divdivnbsp;lt;paramsgt;/divdivnbsp;nbsp;lt;paramgt;/divdivnbsp;nbsp;
 lt;valuegt;/divdivnbsp;nbsp; 
nbsp;lt;stringgt;479153lt;/stringgt;/divdivnbsp;nbsp; 
lt;/valuegt;/divdivnbsp;nbsp;lt;/paramgt;/divdivnbsp;nbsp;lt;paramgt;/divdivnbsp;nbsp;
 lt;valuegt;/div
divnbsp;nbsp; 
nbsp;lt;stringgt;sinojellylt;/stringgt;/divdivnbsp;nbsp; 
lt;/valuegt;/divdivnbsp;nbsp;lt;/paramgt;/divdivnbsp;nbsp;lt;paramgt;/divdivnbsp;nbsp;
 lt;valuegt;/divdivnbsp;nbsp; 
nbsp;lt;stringgt;123456lt;/stringgt;/divdivnbsp;nbsp; 
lt;/valuegt;/div
divnbsp;nbsp;lt;/paramgt;/divdivnbsp;nbsp;lt;paramgt;/divdivnbsp;nbsp;
 lt;valuegt;/divdivnbsp;nbsp; 
nbsp;lt;structgt;/divdivnbsp;nbsp; nbsp; 
lt;membergt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;namegt;titlelt;/namegt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;valuegt;/divdiv
nbsp;nbsp; nbsp; nbsp; lt;stringgt;Just 
Test.lt;/stringgt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;/valuegt;/divdivnbsp;nbsp; nbsp; 
lt;/membergt;/divdivnbsp;nbsp; nbsp; 
lt;membergt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;namegt;descriptionlt;/namegt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;valuegt;/div
divnbsp;nbsp; nbsp; nbsp; lt;stringgt;amp;lt;pamp;gt;Just Test wlw 
post.amp;lt;/pamp;gt;lt;/stringgt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;/valuegt;/divdivnbsp;nbsp; nbsp; 
lt;/membergt;/divdivnbsp;nbsp; nbsp; 
lt;membergt;/divdivnbsp;nbsp; nbsp; 
nbsp;lt;namegt;categorieslt;/namegt;/div

[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

I didn't look at this issue in details.
I'm not a specialist of xmlrpc. But it is unlikely that the patch will be 
accepted, if it fails the regression tests.

Could you investigate this failure and provide a patch which fixes the tests? 
You could add a specific test related to this issue, too.

Command to run the tests (on linux):
python -m test.regrtest test_xmlrpc
 
I've tested with 3.1 branch, and test_xmlrpc fails too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Florent Xicluna

Florent Xicluna la...@yahoo.fr added the comment:

Attached, the output of the test with -v test_xmlrpc.

--
Added file: http://bugs.python.org/file16308/issue7977_test_xmlrpc.log

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-21 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Please could you generate and upload a patch against the Python source?  (For 
Windows, you can do this using the WinMerge tool, amongst others.)  I'm unable 
to open the file you attached on my machine:

No application knows how to open ... xmlrpc.client.modify.rar.

If you could explain how param is being used improperly, that might also 
help.

--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com