# HG changeset patch # User fabien # Date 1066417517 14400 # Node ID 87f94936990d92ea83ebca6ff7e2964529441198 # Parent 4d194fce51e168cbbe512f88a62fd74cee09da8e [svn r1600] Add display name to preferences. diff -r 4d194fce51e1 -r 87f94936990d ChangeLog --- a/ChangeLog Sun Oct 12 11:11:31 2003 -0400 +++ b/ChangeLog Fri Oct 17 15:05:17 2003 -0400 @@ -1,3 +1,9 @@ +xbelweb (0.1-5) unstable; urgency=low + + * Add display name to Preferences. + + -- Fabien Ninoles Fri, 17 Oct 2003 15:04:26 -0400 + xbelweb (0.1-4) unstable; urgency=low * Restrict keywords count to selection. diff -r 4d194fce51e1 -r 87f94936990d edit_prefs.py --- a/edit_prefs.py Sun Oct 12 11:11:31 2003 -0400 +++ b/edit_prefs.py Fri Oct 17 15:05:17 2003 -0400 @@ -25,5 +25,7 @@ prefs['keywords_sort'] = form['kw_sort'].value if form.has_key('kw_reverse'): prefs['keywords_reverse'] = form['kw_reverse'].value <> 0 + if form.has_key('fullname'): + prefs['fullname'] = form['fullname'].value db.set_preferences(prefs) load_index(db) diff -r 4d194fce51e1 -r 87f94936990d lib/create_db.sql --- a/lib/create_db.sql Sun Oct 12 11:11:31 2003 -0400 +++ b/lib/create_db.sql Fri Oct 17 15:05:17 2003 -0400 @@ -3,6 +3,7 @@ CREATE TABLE users ( id int NOT NULL, name varchar(255) DEFAULT '' NOT NULL, + full_name varchar(255) DEFAULT '', PRIMARY KEY (id) ); diff -r 4d194fce51e1 -r 87f94936990d lib/my_db.py --- a/lib/my_db.py Sun Oct 12 11:11:31 2003 -0400 +++ b/lib/my_db.py Fri Oct 17 15:05:17 2003 -0400 @@ -28,9 +28,9 @@ def create_user(self, name): id = self.get_next_id('users') self.crs.execute(""" - INSERT INTO users(id, name) - VALUES (%d, %s); - """ % (id, sql_quote(name))) + INSERT INTO users(id, name, full_name) + VALUES (%d, %s, %s); + """ % (id, sql_quote(name), sql_quote(name))) self.crs.execute(""" INSERT INTO keywords(id, userid, name) VALUES (0, %d, '--'); @@ -60,15 +60,18 @@ self.cnx.commit() def get_preferences(self): self.crs.execute(""" - SELECT keywords_box, - keywords_sort, keywords_reverse - FROM preferences WHERE userid = %d; + SELECT p.keywords_box, + p.keywords_sort, p.keywords_reverse, + u.full_name + FROM preferences p, users u + WHERE u.id = %d AND p.userid = u.id; """ % (self.userid,)) res = self.crs.fetchone() return { 'keywords_box' : res[0], 'keywords_sort' : res[1], - 'keywords_reverse': res[2] + 'keywords_reverse': res[2], + 'fullname': res[3] } def set_preferences(self, prefs): if prefs['keywords_reverse']: @@ -84,6 +87,12 @@ """ % (prefs['keywords_box'], sql_quote(prefs['keywords_sort']), rev, self.userid)) + self.crs.execute(""" + UPDATE users + SET full_name = %s + WHERE id = %d; + """ % (sql_quote(prefs["fullname"]), + self.userid)) self.cnx.commit() def add_bookmark(self, bk): id = self.get_next_id('bookmarks') diff -r 4d194fce51e1 -r 87f94936990d lib/webutils.py --- a/lib/webutils.py Sun Oct 12 11:11:31 2003 -0400 +++ b/lib/webutils.py Fri Oct 17 15:05:17 2003 -0400 @@ -71,7 +71,7 @@ def get_template_processor(prefs): tproc = TemplateProcessor() - tproc.set("remote_user", environ["REMOTE_USER"]) + tproc.set("remote_user", prefs["fullname"]) tproc.set("kw_size", prefs['keywords_box']) tproc.set("kw_sort", prefs['keywords_sort']) tproc.set("kw_reverse", prefs['keywords_reverse']) diff -r 4d194fce51e1 -r 87f94936990d prefs.tmpl --- a/prefs.tmpl Sun Oct 12 11:11:31 2003 -0400 +++ b/prefs.tmpl Fri Oct 17 15:05:17 2003 -0400 @@ -4,6 +4,9 @@

's Preferences

+