aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/controllers/tor.py
diff options
context:
space:
mode:
authorArturo FilastoĢ€ <hellais@torproject.org>2011-08-19 15:05:07 +0200
committerArturo FilastoĢ€ <hellais@torproject.org>2011-08-19 15:05:07 +0200
commit406ad86833f44167cf3719d7d052bdca0c0da0d7 (patch)
treea9d0a239915f78c16a64606354cb4cd6858733b6 /packages/torouter-web/src/tui/controllers/tor.py
parent89a84c8bd8ebad59388b180dc1f8a7e497f3ba58 (diff)
downloadtorouter-406ad86833f44167cf3719d7d052bdca0c0da0d7.tar.gz
torouter-406ad86833f44167cf3719d7d052bdca0c0da0d7.zip
Add support for torrc file read and write
Diffstat (limited to 'packages/torouter-web/src/tui/controllers/tor.py')
-rw-r--r--packages/torouter-web/src/tui/controllers/tor.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/packages/torouter-web/src/tui/controllers/tor.py b/packages/torouter-web/src/tui/controllers/tor.py
index af8678c..eaa587d 100644
--- a/packages/torouter-web/src/tui/controllers/tor.py
+++ b/packages/torouter-web/src/tui/controllers/tor.py
@@ -1,7 +1,7 @@
import web
import view, config
from view import render
-from tui.utils import session, parsing
+from tui.utils import session, parsing, fileio
"""
The main Tor status page
@@ -24,12 +24,22 @@ Tor configuration page
"""
class torrc:
def update_config(self, data):
+ # Now it will just write to /tmp/torrc
+ files = [('/tmp/torrc',data.torrc)]
+ fileio.write(files)
+
return True
def GET(self):
- return render.base(render.torconfig())
+ trc = parsing.torrc(config.torrc_file)
+ output = trc.output()
+ return render.base(render.torconfig(output))
def POST(self):
self.update_config(web.input())
- return render.base(render.torconfig())
+ trc = parsing.torrc(config.torrc_file)
+ trc.parse()
+ output = trc.html_output()
+ return render.base(render.torstatus(output,config.torrc_file))
+