aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/utils
diff options
context:
space:
mode:
authorJacob Appelbaum <jacob@appelbaum.net>2011-08-17 19:31:22 +0200
committerJacob Appelbaum <jacob@appelbaum.net>2011-08-17 19:31:22 +0200
commit57e54f969b840546925d16ceceb130a0f3927140 (patch)
treec2a498d35477d81161783e5eb8e7be726eebc0b0 /packages/torouter-web/src/tui/utils
parent702600566d00c495c418631cd64ee99839fea5a0 (diff)
parent525766e515148f9da5e78d39d1905264a4d14bad (diff)
downloadtorouter-57e54f969b840546925d16ceceb130a0f3927140.tar.gz
torouter-57e54f969b840546925d16ceceb130a0f3927140.zip
Merge branch 'master' of ssh://git-rw.torproject.org/torouter
Diffstat (limited to 'packages/torouter-web/src/tui/utils')
-rw-r--r--packages/torouter-web/src/tui/utils/parsing.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/torouter-web/src/tui/utils/parsing.py b/packages/torouter-web/src/tui/utils/parsing.py
index e9ccc83..6acf988 100644
--- a/packages/torouter-web/src/tui/utils/parsing.py
+++ b/packages/torouter-web/src/tui/utils/parsing.py
@@ -74,6 +74,27 @@ class interfaces:
else:
print "%s %s" % (item[0],item[1])
+class torrc:
+ def __init__(self,filename):
+ self.fp = open(filename, "r")
+ self.parsed = []
+
+ def parse(self):
+ for line in self.fp.readlines():
+ if line.startswith("#") or line == "":
+ continue
+ else:
+ self.parsed.append(line)
+
+ def html_output(self):
+ output = "<ul id=\"torrc\">"
+ for line in self.parsed:
+ if line != "\n":
+ output += "<li><em>%s</em> %s</li>" % (line.split(" ")[0], " ".join(line.split(" ")[1:]))
+ output += "</ul>"
+ print output
+ return output
+
#interfaces_file = os.getcwd() + "/../../../torouter-prep/configs/interfaces"
#itfc = interfaces(interfaces_file)
#itfc.parse()