From 6f00cb2960ea74e28ae24a22c2926c45ad5d5556 Mon Sep 17 00:00:00 2001 From: Eevee Date: Sun, 16 May 2010 19:27:14 -0700 Subject: [PATCH] Use the local model module instead of spline.model. --- splinext/gts/__init__.py | 14 -------------- splinext/gts/controllers/gts.py | 10 ++++------ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/splinext/gts/__init__.py b/splinext/gts/__init__.py index bd10c07..370be29 100644 --- a/splinext/gts/__init__.py +++ b/splinext/gts/__init__.py @@ -4,11 +4,7 @@ from pylons import c, session from spline.lib.plugin import PluginBase from spline.lib.plugin import PluginBase, PluginLink, Priority -import spline.model as model -import spline.model.meta as meta - import splinext.gts.controllers.gts -import splinext.gts.model def add_routes_hook(map, *args, **kwargs): """Hook to inject some of our behavior into the routes configuration.""" @@ -23,16 +19,6 @@ class GTSPlugin(PluginBase): gts = splinext.gts.controllers.gts.GTSController, ) - def model(self): - return [ - splinext.gts.model.GTSPokemon, - ] - - def template_dirs(self): - return [ - (resource_filename(__name__, 'templates'), Priority.NORMAL) - ] - def hooks(self): return [ ('routes_mapping', Priority.NORMAL, add_routes_hook), diff --git a/splinext/gts/controllers/gts.py b/splinext/gts/controllers/gts.py index a9262f0..5f7bfaf 100644 --- a/splinext/gts/controllers/gts.py +++ b/splinext/gts/controllers/gts.py @@ -20,12 +20,10 @@ from sqlalchemy.orm import aliased, contains_eager, eagerload, eagerload_all, jo from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.sql import func -from spline import model from spline.model import meta from spline.lib.base import BaseController, render from spline.lib import helpers as h - -from splinext.gts.model import GTSPokemon +from splinext.gts import model as gts_model log = logging.getLogger(__name__) @@ -153,7 +151,7 @@ class GTSController(BaseController): # Check for an existing Pokémon # TODO support multiple! try: - stored_pokemon = meta.Session.query(model.GTSPokemon) \ + stored_pokemon = meta.Session.query(gts_model.GTSPokemon) \ .filter_by(pid=pid) \ .one() # We've got one! Cool, send it back. The game will ask us to @@ -174,7 +172,7 @@ class GTSController(BaseController): Returns 0x0001. """ - meta.Session.query(model.GTSPokemon).filter_by(pid=pid).delete() + meta.Session.query(gts_model.GTSPokemon).filter_by(pid=pid).delete() meta.Session.commit() return '\x01\x00' @@ -191,7 +189,7 @@ class GTSController(BaseController): pokemon_save = PokemonSave(data, encrypted=True) # Create a record... - stored_pokemon = model.GTSPokemon( + stored_pokemon = gts_model.GTSPokemon( pid=pid, pokemon_blob=pokemon_save.as_struct, ) -- 2.7.4