[svn r1594] Update to use user's preferences.
--- a/add_confirm.py Sun Oct 12 10:55:22 2003 -0400
+++ b/add_confirm.py Sun Oct 12 11:11:31 2003 -0400
@@ -13,7 +13,8 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
import my_db
import time
from bkmark import Bookmark
@@ -56,10 +57,9 @@
kw = unique(kw)
return kw
-def main(action, bk, kw):
+def main(action, bk, kw, prefs):
tmpl = TemplateManager().prepare("add_confirm.tmpl")
- tproc = TemplateProcessor()
- tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
+ tproc = get_template_processor(prefs)
tproc.set("confirm_delete", action == 'delete')
tproc.set("confirm_update", action == 'update')
tproc.set("action", action)
@@ -84,5 +84,5 @@
bk = db.get_bookmarks([id])[0]
(ids, kw) = apply(zip,db.get_keywords([id]))
kw = kw[1:]
- main(action, bk, kw)
+ main(action, bk, kw, db.get_preferences())
--- a/add_confirm.tmpl Sun Oct 12 10:55:22 2003 -0400
+++ b/add_confirm.tmpl Sun Oct 12 11:11:31 2003 -0400
@@ -2,7 +2,7 @@
<html>
<TMPL_INCLUDE NAME="headers.tmpl">
<body>
- <h1><TMPL_VAR pagetitle></h1>
+ <h1><TMPL_VAR remote_user>'s Confirmation</h1>
<form name="confirmation" method="post" action="add_result.py">
<fieldset>
<legend>Bookmark</legend>
--- a/add_result.py Sun Oct 12 10:55:22 2003 -0400
+++ b/add_result.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,7 +11,8 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
import time
from utils import unique
import my_db
@@ -31,10 +32,9 @@
kw.append(id)
return kw
-def main(bk, kw):
+def main(bk, kw, prefs):
tmpl = TemplateManager().prepare("add_result.tmpl")
- tproc = TemplateProcessor()
- tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Result")
+ tproc = get_template_processor(prefs)
tproc.set("url", bk.url)
tproc.set("name", bk.name)
tproc.set("added", bk.added)
@@ -62,4 +62,4 @@
id = bk.id
db.update_keywords(id, kw)
kw = map(lambda e: { 'keyword': e[1] }, db.get_keywords([id])[1:])
- main(bk, kw)
+ main(bk, kw, db.get_preferences())
--- a/add_result.tmpl Sun Oct 12 10:55:22 2003 -0400
+++ b/add_result.tmpl Sun Oct 12 11:11:31 2003 -0400
@@ -2,7 +2,7 @@
<html>
<TMPL_INCLUDE NAME="headers.tmpl">
<body>
- <h1><TMPL_VAR pagetitle></h1>
+ <h1><TMPL_VAR remote_user>'s Add Result</h1>
<p>Bookmark successfully added:</p>
<p><a href="<TMPL_VAR url>"><TMPL_VAR name></a><p>
<p><TMPL_VAR desc></p>
@@ -11,7 +11,7 @@
<TMPL_VAR keyword>;
</TMPL_LOOP></p>
<hr>
- <p>Retour à la <a href="index.py">page principale</a></p>
+ <p>Back to the <a href="index.py">main page</a></p>
</body>
</html>
<!-- Keep this comment at the end of the file
--- a/do_edit_kw.py Sun Oct 12 10:55:22 2003 -0400
+++ b/do_edit_kw.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,15 +11,16 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
import my_db
from bkmark import Bookmark
from webutils import get_keywords
import os
-def main(action, sel_keywords, keywords):
+def main(action, sel_keywords, keywords, prefs):
tmpl = TemplateManager().prepare("kw_confirm.tmpl")
- tproc = TemplateProcessor()
+ tproc = get_template_processor(prefs)
tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Confirmation")
tproc.set("confirm_delete", action == 'delete')
tproc.set("confirm_merge", action == 'merge')
@@ -38,5 +39,5 @@
keywords.sort(lambda x, y: cmp(x['keyword'],y['keyword']))
sel_keywords = filter(lambda e: e['id'] in ids, keywords)
action = form['action'].value
- main(action, sel_keywords, keywords)
+ main(action, sel_keywords, keywords, db.get_preferences())
--- a/do_import.py Sun Oct 12 10:55:22 2003 -0400
+++ b/do_import.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,11 +11,10 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
import time
from utils import unique
import my_db
-from index import load_index
+from webutils import load_index
import os
from xbelimp import parse_xbel, import_bookmarks
--- a/edit.py Sun Oct 12 10:55:22 2003 -0400
+++ b/edit.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,11 +11,11 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
import my_db
import time
from bkmark import Bookmark
-from webutils import get_template_processor;
+from webutils import get_template_processor
import os
def main(keywords, bk, prefs):
--- a/edit_kw.py Sun Oct 12 10:55:22 2003 -0400
+++ b/edit_kw.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,15 +11,15 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
import my_db
import time
import os
-def main(keywords):
+def main(keywords, prefs):
tmpl = TemplateManager().prepare("edit_kw.tmpl")
- tproc = TemplateProcessor()
- tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Edit Keyword")
+ tproc = get_template_processor(prefs)
tproc.set('Keywords', keywords)
print tproc.process(tmpl)
@@ -31,4 +31,4 @@
'id' : elem[0],
'keyword' : elem[1] }, kw)
kw.sort(lambda l,r: cmp(l['keyword'],r['keyword']))
- main(kw)
+ main(kw, db.get_preferences())
--- a/edit_kw.tmpl Sun Oct 12 10:55:22 2003 -0400
+++ b/edit_kw.tmpl Sun Oct 12 11:11:31 2003 -0400
@@ -1,7 +1,7 @@
<html>
<TMPL_INCLUDE NAME="headers.tmpl">
<body>
- <h1><TMPL_VAR pagetitle></h1>
+ <h1><TMPL_VAR remote_user>'s Edit Keywords</h1>
<form action="do_edit_kw.py" method="get" name="edit">
<label>Keywords:
<select multiple name="kw" size="<TMPL_VAR kw_size>">
--- a/import.py Sun Oct 12 10:55:22 2003 -0400
+++ b/import.py Sun Oct 12 11:11:31 2003 -0400
@@ -11,13 +11,13 @@
# import cgitb; cgitb.enable()
import cgi
-from htmltmpl import TemplateManager, TemplateProcessor
+from htmltmpl import TemplateManager
+from webutils import get_template_processor
import os
def main():
tmpl = TemplateManager().prepare("import.tmpl")
- tproc = TemplateProcessor()
- tproc.set("pagetitle", os.environ["REMOTE_USER"]+"'s XBELWeb Import File")
+ tproc = get_template_processor()
print tproc.process(tmpl)
if (__name__ == "__main__"):
--- a/import.tmpl Sun Oct 12 10:55:22 2003 -0400
+++ b/import.tmpl Sun Oct 12 11:11:31 2003 -0400
@@ -2,7 +2,7 @@
<html>
<TMPL_INCLUDE NAME="headers.tmpl">
<body>
- <h1><TMPL_VAR pagetitle></h1>
+ <h1><TMPL_VAR remote_user>'s Import XBel File</h1>
<form enctype="multipart/form-data" action="do_import.py" name="import" method="post">
<label>XBEL file to import: <input type="file" name="xbelfile"/>
<button name="upload">Upload</button>
--- a/kw_confirm.tmpl Sun Oct 12 10:55:22 2003 -0400
+++ b/kw_confirm.tmpl Sun Oct 12 11:11:31 2003 -0400
@@ -2,7 +2,7 @@
<html>
<TMPL_INCLUDE NAME="headers.tmpl">
<body>
- <h1><TMPL_VAR pagetitle></h1>
+ <h1><TMPL_VAR remote_user>'s Confirmation</h1>
<form name="confirmation" method="post" action="kw_result.py">
<TMPL_IF confirm_delete>
<p>Do you really want to remove those keywords?</p>