X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfatables%2Fcommands%2FList.py;h=20576badc786b06eecd80b32507526c42c3a5ba7;hb=4a9e6751f9f396f463932133b9d62fc925a99ef6;hp=86d52a2295f226e9ff084c11281549ee2b4fee75;hpb=7f5d4eef337809e0e0e802ca8c0cc8f695dc0837;p=sfa.git diff --git a/sfatables/commands/List.py b/sfatables/commands/List.py index 86d52a22..20576bad 100644 --- a/sfatables/commands/List.py +++ b/sfatables/commands/List.py @@ -1,8 +1,7 @@ import os, time import libxml2 -import pdb -from sfatables.globals import * +from sfatables.globals import sfatables_config from sfatables.pretty import Pretty from sfatables.command import Command @@ -28,7 +27,6 @@ class List(Command): value_nodes = p.xpathEval("//rule/argument[value!='']/value") element_nodes = p.xpathEval("//argument[value!='']/parent::rule/@element") - print element_nodes, type, xmlextension_path if (len(element_nodes)>1): raise Exception("Invalid rule %s contains multiple elements."%xmlextension_path) @@ -40,8 +38,8 @@ class List(Command): names = [n.content for n in name_nodes] values = [v.content for v in value_nodes] - name_values = zip(names,values) - name_value_pairs = map(lambda (n,v):n+'='+v, name_values) + name_values = list(zip(names,values)) + name_value_pairs = [n_v[0]+'='+n_v[1] for n_v in name_values] argument_str = ",".join(name_value_pairs) @@ -60,13 +58,13 @@ class List(Command): (magic,number,type) = file.split('-') rule_numbers[int(number)]=1 - rule_list = rule_numbers.keys() + rule_list = list(rule_numbers.keys()) rule_list.sort() return rule_list def call(self, command_options, match_options, target_options): if (len(command_options.args) < 1): - print "Please specify the name of the chain you would like to list, e.g. sfatables -L INCOMING." + print("Please specify the name of the chain you would like to list, e.g. sfatables -L INCOMING.") return chain = command_options.args[0]