Hi Peter, thanks a lot for your comments. I think it is more comfortable to be able to upload tools and xml via the webbrowser than to open a terminal and copy them, that was the idea behind my work. Especially for our institute this is very useful. You're right about the check_argument methods. I wasn't sure to add this kind of functionality in the first place, because it can become very tricky. What I did should just be the very first step for someone who wants to continue the work (if this makes sense). That's why I added a checkbox that disable this check, so that you still can upload your tool/xml even the argument test would fail. Do you have some comments about the other parts ? Is this something you would be interested in using ? Best wishes, Bodo Vossen -----Original Message----- From: Peter Cock [mailto:p.j.a.cock@googlemail.com] Sent: Sat 5/28/2011 10:19 PM To: Vossen, Bodo Cc: galaxy-dev@lists.bx.psu.edu Subject: Re: [galaxy-dev] Implemented adding tools via admin console On Fri, May 27, 2011 at 11:21 AM, Vossen, Bodo <Bodo.Vossen@mpi-bn.mpg.de> wrote:
Hi all,
I've implemented functionality for adding tools via the admin menu.
That sounds very useful in principle, although perhaps the less flexible alternative of reloading tool_conf.xml would achieve the same aim?
... Then it is checked if script and XML are "compatible" by checking if they have the same number of arguments.
This seems very fragile, and having looked at the code for detecting the number of arguments in a Python script it looks like it will get it wrong in many situations. Even for something quite simple like this: #sys.argv[0] is the script file itself assert len(sys,argv)==4, "Expect 3 arguments" arg1, arg2, arg3 = sys.argv[1:] Also, what about conditional code like this? assert len(sys.argv)==4, "Expect 3 arguments" if sys.argv[1] == "db": database = sys.argv[2] filename = None else: database = None filename = sys.argv[2] out_filename = sys.argv[3] If I have read your get_parameter_number code right, it would claim there are four arguments since there are four lines of the basic form variable = sys.argv[i] Also, it cannot possibly work when there are a varying number of arguments, for example a repeat argument. If you want a test case, my Venn Diagram tool on the Tool Shed should be relevant (its a python script).
If you have any comments or question please do not hesitate to contact me, I'm open for every kind of critics.
I would remove the attempt to check the number of arguments. It is practically impossible to get this right in all cases, so I don't think it is worth doing. Having valid script/xml combinations rejected would be quite annoying. Peter