Update index.py and config to use the right information.
authorfabien@tzone.org
Tue, 30 Dec 2008 23:32:33 -0500
changeset 67 652ff41518f3
parent 65 b975a3d7606a
child 68 c1f1491f098c
Update index.py and config to use the right information.
ChangeLog
INSTALL
TODO
index.py
index.py.ex
lib/xbelweb.py
--- 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 <fabien@tzone.org>  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.
--- 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.
 
 
--- 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
--- 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 "<pre>"
-    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 "</pre>"
--- /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()
--- /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 "<pre>"
+    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 "</pre>"