[Cryptech-Commits] [user/sra/pelican] 23/68: Syntactic sugar

git at cryptech.is git at cryptech.is
Mon Jul 19 22:25:02 UTC 2021


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch pelican
in repository user/sra/pelican.

commit fa8b4d0e872d182ee878020fb1b066ce0da621ae
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Sun Feb 14 01:13:52 2021 +0000

    Syntactic sugar
---
 tools/extract.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/extract.py b/tools/extract.py
index d60de84..f323d44 100644
--- a/tools/extract.py
+++ b/tools/extract.py
@@ -53,11 +53,15 @@ def keep(name):
             return k == "+"
     return True
 
+class Row(sqlite3.Row):
+    def __getattr__(self, name):
+        return self[name]
+
 db = sqlite3.connect("trac.db")
-db.row_factory = sqlite3.Row
+db.row_factory = Row
 
 for row in db.execute(wiki_query):
-    if keep(row["name"]):
-        print(urllib.parse.quote(row["name"], ""), row["version"])
+    if keep(row.name):
+        print(urllib.parse.quote(row.name, ""), row.version)
 
 db.close()



More information about the Commits mailing list