1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Made more extensive usage of context managers with open.

This commit is contained in:
Claude Paroz
2012-05-05 14:01:38 +02:00
parent ec5423df05
commit 865cd35c9b
33 changed files with 178 additions and 233 deletions

View File

@@ -120,12 +120,9 @@ class SpatiaLiteCreation(DatabaseCreation):
# Opening up the SpatiaLite SQL initialization file and executing
# as a script.
sql_fh = open(spatialite_sql, 'r')
try:
with open(spatialite_sql, 'r') as sql_fh:
cur = self.connection._cursor()
cur.executescript(sql_fh.read())
finally:
sql_fh.close()
def spatialite_init_file(self):
# SPATIALITE_SQL may be placed in settings to tell GeoDjango