diff --git a/VERSION b/VERSION index 3fdc34f1..0b3384e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-11-24 10:47:44) stable +Version 2.2.1 (2012-11-24 10:58:12) stable diff --git a/gluon/dal.py b/gluon/dal.py index d41a8116..dfd0b28f 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -4010,12 +4010,17 @@ class DatabaseStoredFile: self.data += data def close_connection(self): - self.db.executesql( - "DELETE FROM web2py_filesystem WHERE path='%s'" % self.filename) - query = "INSERT INTO web2py_filesystem(path,content) VALUES ('%s','%s')"\ - % (self.filename, self.data.replace("'","''")) - self.db.executesql(query) - self.db.commit() + if self.db is not None: + self.db.executesql( + "DELETE FROM web2py_filesystem WHERE path='%s'" % self.filename) + query = "INSERT INTO web2py_filesystem(path,content) VALUES ('%s','%s')"\ + % (self.filename, self.data.replace("'","''")) + self.db.executesql(query) + self.db.commit() + self.db = None + + def close(self): + self.close_connection() @staticmethod def exists(db, filename):