From ba32a8d0dcee7f3cef231e08ed60d52fbf60ed4f Mon Sep 17 00:00:00 2001 From: Atsushi Odagiri Date: Sat, 27 Nov 2010 15:08:07 +0900 Subject: :: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (IntegrityError) column name is not unique u'INSERT INTO models (name, value) VALUES (?, ?)' (u'root', 55) --- pyramid/paster_templates/alchemy/+package+/models.py | 2 +- pyramid/paster_templates/pylons_sqla/+package+/models.py | 2 +- pyramid/paster_templates/routesalchemy/+package+/models.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyramid/paster_templates/alchemy/+package+/models.py b/pyramid/paster_templates/alchemy/+package+/models.py index 336613cf9..b0a00b648 100755 --- a/pyramid/paster_templates/alchemy/+package+/models.py +++ b/pyramid/paster_templates/alchemy/+package+/models.py @@ -81,7 +81,7 @@ def initialize_sql(db_string, db_echo=False): try: populate() except IntegrityError: - pass + DBSession.rollback() def appmaker(db_string, db_echo=False): initialize_sql(db_string, db_echo) diff --git a/pyramid/paster_templates/pylons_sqla/+package+/models.py b/pyramid/paster_templates/pylons_sqla/+package+/models.py index 092166902..e1fc7f43c 100644 --- a/pyramid/paster_templates/pylons_sqla/+package+/models.py +++ b/pyramid/paster_templates/pylons_sqla/+package+/models.py @@ -44,4 +44,4 @@ def initialize_sql(db_string, db_echo=False): try: populate() except IntegrityError: - pass + DBSession.rollback() diff --git a/pyramid/paster_templates/routesalchemy/+package+/models.py b/pyramid/paster_templates/routesalchemy/+package+/models.py index a1726ebf4..fd439a4c2 100644 --- a/pyramid/paster_templates/routesalchemy/+package+/models.py +++ b/pyramid/paster_templates/routesalchemy/+package+/models.py @@ -41,4 +41,4 @@ def initialize_sql(db_string, db_echo=False): try: populate() except IntegrityError: - pass + DBSession.rollback() -- cgit v1.2.3