[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fix ordering of torrc entires



commit 85e6744e30ba6676996148407e56d38bbb4fb559
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Aug 26 14:34:36 2017 -0700

    Fix ordering of torrc entires
    
    We procide torrc entries ordered by how they appeared in the manual. I thought
    sqlite would default to ordering them by insertion but I was wrong. Including
    the position as a field we can sort by.
---
 stem/cached_tor_manual.sqlite | Bin 202752 -> 204800 bytes
 stem/manual.py                |   8 ++++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/stem/cached_tor_manual.sqlite b/stem/cached_tor_manual.sqlite
index 90115e98..214abe3c 100644
Binary files a/stem/cached_tor_manual.sqlite and b/stem/cached_tor_manual.sqlite differ
diff --git a/stem/manual.py b/stem/manual.py
index a4590578..fc648cc9 100644
--- a/stem/manual.py
+++ b/stem/manual.py
@@ -372,7 +372,7 @@ class Manual(object):
 
       config_options = OrderedDict()
 
-      for entry in conn.execute('SELECT name, category, usage, summary, description FROM torrc').fetchall():
+      for entry in conn.execute('SELECT name, category, usage, summary, description FROM torrc ORDER BY position').fetchall():
         option, category, usage, summary, option_description = entry
         config_options[option] = ConfigOption(option, category, usage, summary, option_description)
 
@@ -520,7 +520,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)')
+      conn.execute('CREATE TABLE torrc(name TEXT PRIMARY KEY, 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))
 
@@ -533,8 +533,8 @@ class Manual(object):
       for k, v in self.files.items():
         conn.execute('INSERT INTO files(name, description) VALUES (?,?)', (k, v))
 
-      for v in self.config_options.values():
-        conn.execute('INSERT INTO torrc(name, category, usage, summary, description) VALUES (?,?,?,?,?)', (v.name, v.category, v.usage, v.summary, v.description))
+      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))
 
     if os.path.exists(path):
       os.remove(path)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits