[tor-commits] [stem/master] Allow case insensitive torrc attribute lookups

atagar at torproject.org atagar at torproject.org
Sun Aug 27 00:10:49 UTC 2017


commit 9a4688d6338fe20862fccc5dc63373f8c8c2eb82
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Aug 26 17:08:44 2017 -0700

    Allow case insensitive torrc attribute lookups
    
    Making the primary key uppercase so we can do case insensitive lookups.
---
 stem/manual.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/manual.py b/stem/manual.py
index e78f917c..9b9c0252 100644
--- a/stem/manual.py
+++ b/stem/manual.py
@@ -526,7 +526,7 @@ class Manual(object):
       conn.execute('CREATE TABLE commandline(name TEXT PRIMARY KEY, description TEXT)')
       conn.execute('CREATE TABLE signals(name TEXT PRIMARY KEY, description TEXT)')
       conn.execute('CREATE TABLE files(name TEXT PRIMARY KEY, description TEXT)')
-      conn.execute('CREATE TABLE torrc(name TEXT PRIMARY KEY, category TEXT, usage TEXT, summary TEXT, description TEXT, position NUMBER)')
+      conn.execute('CREATE TABLE torrc(key TEXT PRIMARY KEY, name TEXT, category TEXT, usage TEXT, summary TEXT, description TEXT, position NUMBER)')
 
       conn.execute('INSERT INTO metadata(name, synopsis, description, man_commit, stem_commit) VALUES (?,?,?,?,?)', (self.name, self.synopsis, self.description, self.man_commit, self.stem_commit))
 
@@ -540,7 +540,7 @@ class Manual(object):
         conn.execute('INSERT INTO files(name, description) VALUES (?,?)', (k, v))
 
       for i, v in enumerate(self.config_options.values()):
-        conn.execute('INSERT INTO torrc(name, category, usage, summary, description, position) VALUES (?,?,?,?,?,?)', (v.name, v.category, v.usage, v.summary, v.description, i))
+        conn.execute('INSERT INTO torrc(key, name, category, usage, summary, description, position) VALUES (?,?,?,?,?,?,?)', (v.name.upper(), v.name, v.category, v.usage, v.summary, v.description, i))
 
     if os.path.exists(path):
       os.remove(path)



More information about the tor-commits mailing list