From 1a75c1e59305414d6ca543d2219c4089d014f7dc Mon Sep 17 00:00:00 2001 From: Arturo Filastò Date: Fri, 19 Aug 2011 15:28:49 +0200 Subject: Move to correct location config and view and fix import on runui --- packages/torouter-web/src/runui.py | 2 +- packages/torouter-web/src/tui/config.py | 17 +++++++++++++++++ packages/torouter-web/src/tui/view.py | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 packages/torouter-web/src/tui/config.py create mode 100644 packages/torouter-web/src/tui/view.py diff --git a/packages/torouter-web/src/runui.py b/packages/torouter-web/src/runui.py index 43d8943..d5c7c9e 100644 --- a/packages/torouter-web/src/runui.py +++ b/packages/torouter-web/src/runui.py @@ -8,7 +8,7 @@ from tui import config import tui.controllers from tui.utils import session -from view import render +from tui.view import render # This is the main structure of URLs 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' +# + +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/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 + -- cgit v1.2.3 From 45c581baf28c673e20edb5af58da780311847fbb Mon Sep 17 00:00:00 2001 From: Arturo Filastò Date: Fri, 19 Aug 2011 15:53:01 +0200 Subject: Comment out two testing lines --- packages/torouter-web/src/tui/utils/fileio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/torouter-web/src/tui/utils/fileio.py b/packages/torouter-web/src/tui/utils/fileio.py index 3234f1e..87c6362 100644 --- a/packages/torouter-web/src/tui/utils/fileio.py +++ b/packages/torouter-web/src/tui/utils/fileio.py @@ -15,7 +15,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) -- cgit v1.2.3 From 61ed2b6b5c7605a9faf4ad531d7dc3f1eb1b1f2d Mon Sep 17 00:00:00 2001 From: Arturo Filastò Date: Fri, 19 Aug 2011 15:54:47 +0200 Subject: Write to /var/tmp --- packages/torouter-web/src/tui/utils/fileio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/torouter-web/src/tui/utils/fileio.py b/packages/torouter-web/src/tui/utils/fileio.py index 87c6362..aea5462 100644 --- a/packages/torouter-web/src/tui/utils/fileio.py +++ b/packages/torouter-web/src/tui/utils/fileio.py @@ -3,7 +3,7 @@ import os def write(files): tmpfiles = [] for file in files: - tmpfile = "/tmp/" + file[0].split("/")[-1:][0] + ".tmp" + tmpfile = "/var/tmp/" + file[0].split("/")[-1:][0] + ".tmp" tmpfiles.append((tmpfile,file[0])) # open the tmp file for write f = open(tmpfile, 'w') -- cgit v1.2.3 From 2ec2f16558d474ba517d9a2ce337a79c3be55a9d Mon Sep 17 00:00:00 2001 From: Arturo Filastò Date: Fri, 19 Aug 2011 15:59:04 +0200 Subject: Write to /var/tmp/tor-tui --- packages/torouter-web/src/tui/utils/fileio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/torouter-web/src/tui/utils/fileio.py b/packages/torouter-web/src/tui/utils/fileio.py index aea5462..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 = "/var/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') -- cgit v1.2.3