--- a/index.py Tue Sep 23 15:11:11 2003 -0400
+++ b/index.py Wed Sep 24 13:29:36 2003 -0400
@@ -13,6 +13,8 @@
import cgi
from htmltmpl import TemplateManager, TemplateProcessor
import my_db
+from os import environ
+from urlparse import urljoin
def get_selection(form):
kw = form.getvalue("kw")
@@ -32,11 +34,15 @@
'checked' : chk})
return res
-def main(bk, kw):
+def get_curl():
+ return urljoin( 'http://' + environ["HTTP_HOST"] + environ["REQUEST_URI"], 'add.py')
+
+def main(bk, kw, curl):
tmpl = TemplateManager().prepare("index.tmpl")
tproc = TemplateProcessor()
tproc.set("Bookmarks", bk)
tproc.set("Keywords", kw)
+ tproc.set("curl", curl)
print tproc.process(tmpl)
if (__name__ == "__main__"):
@@ -52,4 +58,5 @@
keywords = set_selection(keywords, selection)
bookmarks = db.get_bookmarks(map(lambda x: x[0], bookmarks))
bookmarks = map(lambda bk: bk.dict(), bookmarks)
- main(bookmarks, keywords)
+ curl = get_curl();
+ main(bookmarks, keywords, curl)