diff options
author | makkalot <makkalot@gmail.com> | 2008-08-11 23:19:25 +0300 |
---|---|---|
committer | makkalot <makkalot@gmail.com> | 2008-08-11 23:19:25 +0300 |
commit | dc00ae6b0a91210ab4686173df80daee53cc1f48 (patch) | |
tree | 02ae7de77d563dfa88ec5522fcdd6905874f5f3e /funcweb | |
parent | f0c042888db84e241d63cf33683644ab83b65437 (diff) | |
download | func-dc00ae6b0a91210ab4686173df80daee53cc1f48.tar.gz func-dc00ae6b0a91210ab4686173df80daee53cc1f48.tar.xz func-dc00ae6b0a91210ab4686173df80daee53cc1f48.zip |
fix in the controller for list*
Diffstat (limited to 'funcweb')
-rw-r--r-- | funcweb/funcweb/controllers.py | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/funcweb/funcweb/controllers.py b/funcweb/funcweb/controllers.py index 32cde3f..9cf7fc3 100644 --- a/funcweb/funcweb/controllers.py +++ b/funcweb/funcweb/controllers.py @@ -337,13 +337,33 @@ class Funcweb(object): flash("Encountered some error when trying to get method arguments for %s.%s.%s"%(minion,module,method)) return dict() #so we know the order just allocate and put them there - cmd_args=['']*(len(kw.keys())) - + cmd_args=[] + + #firstly create a better dict to lookup + sorted_args = {} for arg in kw.keys(): #wow what a lookup :) - index_of_arg = arguments[minion][method]['args'][arg]['order'] - cmd_args[index_of_arg]=kw[arg] - + tmp_arg_num = arguments[minion][method]['args'][arg]['order'] + sorted_args[tmp_arg_num] = [] + sorted_args[tmp_arg_num].append(arg) + sorted_args[tmp_arg_num].append(kw[arg]) + + #now append them to main cmd args + #not a very efficient algorithm i know i know :| + ordered_keys = sorted_args.keys() + ordered_keys.sort() + for order_key in ordered_keys: + current_argument_name = sorted_args[order_key][0] + current_argument = sorted_args[order_key][1] + current_type = arguments[minion][method]['args'][current_argument_name]['type'] + #for *args types + if current_type == "list*": + for list_arg in current_argument: + cmd_args.append(list_arg) + else: + cmd_args.append(current_argument) + + #print "The list to be send is : ",cmd_args #now execute the stuff #at the final execute it as a multiple if the glob suits for that #if not (actually there shouldnt be an option like that but who knows :)) |