26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
-
+
|
# wrapper around database
class tagDB:
__slots__ = frozenset(['_prepared', '_dump_stmt', '_db'])
def __init__(self):
self._prepared = set()
self._db = False
self._dump_stmt = self._curs().prepare("select untrip(site), tag, regexp from urls natural join site natural join tag")
self._dump_stmt = self._curs().prepare("select untrip(site), tag, regexp from urls natural join site natural join tag order by site, tag")
def _curs(self):
if not self._db:
config.section('database')
self._db = postgresql.open(
'pq://{}:{}@{}/{}'.format(
config['user'],
|