fixed issue 1176, truncate on GAE+SQL

This commit is contained in:
mdipierro
2012-11-24 10:58:44 -06:00
parent 43c97bd8cc
commit fe4713ad88
2 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-11-24 10:47:44) stable Version 2.2.1 (2012-11-24 10:58:12) stable
+11 -6
View File
@@ -4010,12 +4010,17 @@ class DatabaseStoredFile:
self.data += data self.data += data
def close_connection(self): def close_connection(self):
self.db.executesql( if self.db is not None:
"DELETE FROM web2py_filesystem WHERE path='%s'" % self.filename) self.db.executesql(
query = "INSERT INTO web2py_filesystem(path,content) VALUES ('%s','%s')"\ "DELETE FROM web2py_filesystem WHERE path='%s'" % self.filename)
% (self.filename, self.data.replace("'","''")) query = "INSERT INTO web2py_filesystem(path,content) VALUES ('%s','%s')"\
self.db.executesql(query) % (self.filename, self.data.replace("'","''"))
self.db.commit() self.db.executesql(query)
self.db.commit()
self.db = None
def close(self):
self.close_connection()
@staticmethod @staticmethod
def exists(db, filename): def exists(db, filename):