# HG changeset patch # User fabien@tzone.org # Date 1230697953 18000 # Node ID 652ff41518f36f4d36dfbc304c3ce425ea4c5a64 # Parent b975a3d7606a96865c616b99d3df5d9e2fb287fc Update index.py and config to use the right information. diff -r b975a3d7606a -r 652ff41518f3 ChangeLog --- a/ChangeLog Tue Dec 30 22:32:10 2008 -0500 +++ b/ChangeLog Tue Dec 30 23:32:33 2008 -0500 @@ -1,3 +1,10 @@ +xbelweb (0.1-7) unstable; urgency=low + + * Rewrite the architecture completely with cleaner separation and + common entry-point. + + -- Fabien Ninoles Sun, 28 Dec 2008 15:05:51 -0500 + xbelweb (0.1-6) unstable; urgency=low * Optimization of get_bookmarks_count which was call too often. diff -r b975a3d7606a -r 652ff41518f3 INSTALL --- a/INSTALL Tue Dec 30 22:32:10 2008 -0500 +++ b/INSTALL Tue Dec 30 23:32:33 2008 -0500 @@ -40,6 +40,6 @@ ./lib/db/create_db.[your database] definition. I do it with psql -U php < create_db.postgresql -4. Update the lib/config.py file to reflect your db configuration. +4. Copy index.py.ex to index.py and edit the necessary information. diff -r b975a3d7606a -r 652ff41518f3 TODO --- a/TODO Tue Dec 30 22:32:10 2008 -0500 +++ b/TODO Tue Dec 30 23:32:33 2008 -0500 @@ -1,5 +1,5 @@ +* Add test unit. * Add licences notes to src files. -* Make it a stateless with single entry point wellform CGI program. * Add synonymous support. * Add "new keyword" enlighting, maybe with link to keyword editing. * Add similar keywords suggestions. Otherly said: "Bookmarks which have diff -r b975a3d7606a -r 652ff41518f3 index.py --- a/index.py Tue Dec 30 22:32:10 2008 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#!/usr/bin/python - -import sys -import traceback -if (__name__ == '__main__'): - sys.path.insert(0, "/home/fabien/lib/python") - sys.path.insert(0, "./lib") - sys.stderr = sys.stdout - - print "Content-type: text/html; charset=iso-8859-1;" - print - -# import cgitb; cgitb.enable() -import cgi -import my_db - -from local_config import CONFIG -from os import environ -from actions import actions - -if (__name__ == "__main__"): - form = cgi.FieldStorage() - if form.has_key('debug'): - sys.stderr = sys.stdout - print "
"
-    db = my_db.connect(CONFIG, environ["REMOTE_USER"])
-    prefs = db.get_preferences()
-    if form.has_key('action'):
-    	action = form['action'].value
-    else:
-    	action = 'default'
-    if action in actions.keys():
-    	actions[action](action, db, prefs, form)
-    else:
-    	actions['default']('default', db, prefs, form)
-    print "
" diff -r b975a3d7606a -r 652ff41518f3 index.py.ex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.py.ex Tue Dec 30 23:32:33 2008 -0500 @@ -0,0 +1,18 @@ +#!/usr/bin/python + +if (__name__ == '__main__'): + sys.path.insert(0, "/home/fabien/lib/python") + sys.path.insert(0, "./lib") + +from config import CONFIG + +CONFIG.db_name = 'database_name' +CONFIG.db_user = 'my_user' +CONFIG.db_host = 'db.host.com' +CONFIG.db_passwd = 'secr3t.passwd' +# CONFIG.db_port = 5432 + +import xbelweb + +if (__name__ == "__main__"): + xbelweb.main() diff -r b975a3d7606a -r 652ff41518f3 lib/xbelweb.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/xbelweb.py Tue Dec 30 23:32:33 2008 -0500 @@ -0,0 +1,30 @@ +#!/usr/bin/python + +import sys +import cgi +import my_db +from os import environ +from actions import actions +from config import CONFIG + +def main(): + sys.stderr = sys.stdout + print "Content-type: text/html; charset=iso-8859-1;" + print + form = cgi.FieldStorage() + debug = form.has_key('debug') + if debug: + sys.stderr = sys.stdout + print "
"
+    db = my_db.connect(CONFIG, environ["REMOTE_USER"])
+    prefs = db.get_preferences()
+    if form.has_key('action'):
+    	action = form['action'].value
+    else:
+    	action = 'default'
+    if action in actions.keys():
+    	actions[action](action, db, prefs, form)
+    else:
+    	actions['default']('default', db, prefs, form)
+    if debug:
+    	print "
"