diff options
author | Rob Austein <sra@hactrn.net> | 2021-02-14 01:13:52 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2021-02-14 01:13:52 +0000 |
commit | fa8b4d0e872d182ee878020fb1b066ce0da621ae (patch) | |
tree | 3c127be3c0611bd8e81477dd41aa75408986e391 /tools | |
parent | dc6ef096698dcd18d1755a45d79d0b87368a6ce6 (diff) |
Syntactic sugar
Diffstat (limited to 'tools')
-rw-r--r-- | tools/extract.py | 10 |
1 files 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() |