From 285811f8520af6207c2aa07eacafd438a6e93034 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Mon, 24 Jun 2013 00:20:11 +0200 Subject: [PATCH 1/4] check that session_id exists before trying to renew session from the db --- gluon/globals.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gluon/globals.py b/gluon/globals.py index f4f0eb71..163fda2b 100644 --- a/gluon/globals.py +++ b/gluon/globals.py @@ -546,7 +546,9 @@ class Session(Storage): # else the session goes in db elif response.session_storage_type == 'db': - + # verify that session_id exists + if not response.session_id: + return # verify if tablename was set or used in connect if response.session_table_name and tablename == 'web2py_session': tablename = response.session_table_name From b6329709605f1a2796d45aad0b8543a96a57bdef Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Mon, 24 Jun 2013 00:52:15 +0200 Subject: [PATCH 2/4] record versioning must ignore tables without _id field. --- gluon/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/tools.py b/gluon/tools.py index b8e9a360..57486531 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -1450,7 +1450,7 @@ class Auth(object): """ tables = [table for table in tables] for table in tables: - if 'modified_on' in table.fields() and not current_record in table.fields(): + if '_id' in table.fields() and 'modified_on' in table.fields() and not current_record in table.fields(): table._enable_record_versioning( archive_db=archive_db, archive_name=archive_names, From c8cb3c94efac0122f987e637f5163148d27d03ba Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Mon, 24 Jun 2013 00:57:24 +0200 Subject: [PATCH 3/4] added empty line --- gluon/globals.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gluon/globals.py b/gluon/globals.py index 163fda2b..940d7f3e 100644 --- a/gluon/globals.py +++ b/gluon/globals.py @@ -549,6 +549,7 @@ class Session(Storage): # verify that session_id exists if not response.session_id: return + # verify if tablename was set or used in connect if response.session_table_name and tablename == 'web2py_session': tablename = response.session_table_name From e311da344128c2212652b6a7be4e95779bb3ebf3 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Mon, 24 Jun 2013 15:23:57 +0200 Subject: [PATCH 4/4] "reference table.field" type bugfix --- gluon/dal.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gluon/dal.py b/gluon/dal.py index b67fc3d2..b579d8cb 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -2549,6 +2549,9 @@ class PostgreSQLAdapter(BaseAdapter): 'geography': 'GEOGRAPHY', 'big-id': 'BIGSERIAL PRIMARY KEY', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', + 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', + 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON DELETE %(on_delete_action)s', + } def varquote(self,name):