From 8e1a68d461b0a0832e054f630feff462d15542a3 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 20 Oct 2013 16:58:08 -0500 Subject: [PATCH] simplified logic --- VERSION | 2 +- gluon/dal.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index a7488a41..641044af 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.10.20.16.50.33 +Version 2.7.4-stable+timestamp.2013.10.20.16.57.08 diff --git a/gluon/dal.py b/gluon/dal.py index 6d6f567e..22a2a80b 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -2274,8 +2274,7 @@ class SQLiteAdapter(BaseAdapter): self.db = db self.dbengine = "sqlite" self.uri = uri - if adapter_args.get('foreign_keys',True) and not after_connection: - after_connection = lambda db: db.execute('PRAGMA foreign_keys=ON;') + self.adapter_args = adapter_args if do_connect: self.find_driver(adapter_args) self.pool_size = 0 self.folder = folder @@ -2308,6 +2307,9 @@ class SQLiteAdapter(BaseAdapter): SQLiteAdapter.web2py_extract) self.connection.create_function("REGEXP", 2, SQLiteAdapter.web2py_regexp) + + if self.adapter_args.get('foreign_keys',True): + self.execute('PRAGMA foreign_keys=ON;') def _truncate(self, table, mode=''): tablename = table._tablename