Skip to content

Commit

Permalink
Merge pull request #29 from retorquere/bbt.132
Browse files Browse the repository at this point in the history
fixes betterbibtex cite key access after better bibtex upgrade
  • Loading branch information
plandes authored Oct 25, 2023
2 parents d28a1ef + f6df9e3 commit e559f73
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/python/zensols/zotsite/betterbib.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ def __init__(self, lib: Library):
def data(self) -> Dict[str, Any]:
path = self.lib.data_dir / 'better-bibtex.sqlite'
logger.info(f'reading bibtex DB at {path}')
conn = sqlite3.connect(path)
conn = sqlite3.connect(':memory:')
conn.execute('ATTACH DATABASE ? AS betterbibtex', (path,))
try:
rows = tuple(conn.execute("""select * from `better-bibtex`"""))
assert len(rows) == 3
rows = tuple(filter(lambda r: r[0] == 'better-bibtex.citekey', rows))
assert len(rows) == 1
jstr = rows[0][1]
return json.loads(jstr)
return [ tuple(k) for k in conn.execute("""select * from betterbibtex.citationkey""") ]
finally:
conn.close()

Expand Down

0 comments on commit e559f73

Please sign in to comment.