X-Git-Url: http://git.veekun.com/zzz-spline-gts.git/blobdiff_plain/30d693c5e60d1ddbe99fadaf22583d02d79c93b5..05241040f15babeb7f9f27ff36ce46a546115b79:/splinext/gts/controllers/gts.py diff --git a/splinext/gts/controllers/gts.py b/splinext/gts/controllers/gts.py index 15b3457..c4bed33 100644 --- a/splinext/gts/controllers/gts.py +++ b/splinext/gts/controllers/gts.py @@ -14,11 +14,12 @@ import pokedex.db.tables as tables import pokedex.formulae from pokedex.struct import SaveFilePokemon from pylons import config, request, response, session, tmpl_context as c, url -from pylons.controllers.util import abort, redirect_to +from pylons.controllers.util import abort, redirect from sqlalchemy import and_, or_, not_ from sqlalchemy.orm import aliased, contains_eager, eagerload, eagerload_all, join from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.sql import func +from sqlalchemy.exc import IntegrityError from spline.model import meta from spline.lib.base import BaseController, render @@ -196,9 +197,9 @@ class GTSController(BaseController): meta.Session.add(stored_pokemon) meta.Session.commit() return '\x01\x00' - except: - # If that failed (presumably due to unique key collision), we're - # already storing something. Reject! + except IntegrityError: + # If that failed due to unique key collision, we're already storing + # something. Reject! return '\x0c\x00' def page_post_finish(self, pid, data):