mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2025-01-24 19:33:25 +01:00
Alan Orth
2f342be948
Instead of opening one global persistent database connection when the application I am now abstracting it to a class that I can use in combination with Python's "with" context. Both connections and cursors are kept for the context of each "with" block and closed automatically when exiting. See: https://alysivji.github.io/managing-resources-with-context-managers-pythonic.html See: http://initd.org/psycopg/docs/connection.html#connection.close