Skip to content

Commit 1689322

Browse files
author
Kareem Zidane
authoredJan 13, 2020
Merge pull request #109 from cs50/develop
disconnecting only if there's a connection
2 parents d1e5ff7 + c0b24da commit 1689322

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
package_dir={"": "src"},
1717
packages=["cs50"],
1818
url="https://github.com/cs50/python-cs50",
19-
version="5.0.1"
19+
version="5.0.2"
2020
)

‎src/cs50/sql.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ def execute(self, sql, *args, **kwargs):
281281
# Disconnect later
282282
@flask.current_app.teardown_appcontext
283283
def shutdown_session(exception=None):
284-
flask.g._connection.close()
284+
if hasattr(flask.g, "_connection"):
285+
flask.g._connection.close()
285286

286287
# Use this connection
287288
connection = flask.g._connection

0 commit comments

Comments
 (0)
Please sign in to comment.