aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui
diff options
context:
space:
mode:
authorJacob Appelbaum <jacob@appelbaum.net>2011-08-19 15:54:52 +0200
committerJacob Appelbaum <jacob@appelbaum.net>2011-08-19 15:54:52 +0200
commitb18611fa5a246c254074c4f38229f55acedff3b6 (patch)
tree513e8700cc400b788d5933bdbe9145287cfc1795 /packages/torouter-web/src/tui
parent8f7c217f8470afc02ea678fd37838b01a6b2423c (diff)
parent2ec2f16558d474ba517d9a2ce337a79c3be55a9d (diff)
downloadtorouter-b18611fa5a246c254074c4f38229f55acedff3b6.tar.gz
torouter-b18611fa5a246c254074c4f38229f55acedff3b6.zip
Merge branch 'master' of ssh://git-rw.torproject.org/torouter
Diffstat (limited to 'packages/torouter-web/src/tui')
-rw-r--r--packages/torouter-web/src/tui/config.py17
-rw-r--r--packages/torouter-web/src/tui/utils/fileio.py11
-rw-r--r--packages/torouter-web/src/tui/view.py11
3 files changed, 35 insertions, 4 deletions
diff --git a/packages/torouter-web/src/tui/config.py b/packages/torouter-web/src/tui/config.py
new file mode 100644
index 0000000..f3f8dcc
--- /dev/null
+++ b/packages/torouter-web/src/tui/config.py
@@ -0,0 +1,17 @@
+# tui, Tor web UI
+# by Arturo Filasto' <hellais@torproject.org>
+#
+
+import web, os
+
+cache = False
+
+globals = {}
+
+# Add your own (username, password) pair
+authinfo = ("test", "test")
+
+interfaces_file = os.getcwd() + "/../../torouter-prep/configs/interfaces"
+#torrc_file = os.getcwd() + "/../../torouter-prep/configs/torrc"
+torrc_file = "/tmp/torrc"
+
diff --git a/packages/torouter-web/src/tui/utils/fileio.py b/packages/torouter-web/src/tui/utils/fileio.py
index 3234f1e..0675f3f 100644
--- a/packages/torouter-web/src/tui/utils/fileio.py
+++ b/packages/torouter-web/src/tui/utils/fileio.py
@@ -1,9 +1,12 @@
import os
def write(files):
+ tmp_dir = "/var/tmp/tor-tui"
tmpfiles = []
for file in files:
- tmpfile = "/tmp/" + file[0].split("/")[-1:][0] + ".tmp"
+ if not os.path.exists(tmp_dir):
+ os.mkdir(tmp_dir)
+ tmpfile = tmp_dir + file[0].split("/")[-1:][0] + ".tmp"
tmpfiles.append((tmpfile,file[0]))
# open the tmp file for write
f = open(tmpfile, 'w')
@@ -15,7 +18,7 @@ def write(files):
for file in tmpfiles:
os.rename(file[0], file[1])
-files = [('/tmp/file1','blablbal'),('/tmp/file2','The content'),('/tmp/file3','The content 3')]
-
-write(files)
+# for testing
+#files = [('/tmp/file1','blablbal'),('/tmp/file2','The content'),('/tmp/file3','The content 3')]
+#write(files)
diff --git a/packages/torouter-web/src/tui/view.py b/packages/torouter-web/src/tui/view.py
new file mode 100644
index 0000000..0252ad8
--- /dev/null
+++ b/packages/torouter-web/src/tui/view.py
@@ -0,0 +1,11 @@
+import web
+from tui import config
+
+t_globals = dict(
+ datestr=web.datestr,
+ )
+
+# create the render object
+render = web.template.render('tui/views', cache=config.cache, globals=t_globals)
+render._keywords['globals']['render'] = render
+