On Tue, Jul 13, 2010 at 3:29 PM, Guyren G Howe <[email protected]> wrote:
> Having only made changes discussed in recent emails here in order to get my
> routes to not be ignored (adding some code from a sample project to replace
> load_environment in my environment.py), I now get this error:
> "UnboundExecutionError: Could not locate a bind configured on mapper" What
> are "mapper" and "bind" in this error message, and what the heck is going on?
>
> Here is what the trace looks like:
>
> URL: http://ojive.com:8080/admin/
> File
> '/Users/gisborne/Documents/iparq/tg2env/lib/python2.6/site-packages/sqlalchemy/orm/session.py',
> line 888 in get_bind
> ', '.join(context)))
> UnboundExecutionError: Could not locate a bind configured on mapper
> Mapper|User|tg_user, SQL expression or this Session
This is a SQLAlchemy mapper, not a Routes mapper. SQLAlchemy has its
own definitions for "mapper" and "session". The error means that the
session is not attached ("bound") to a database, so it can't run a
query. This suggests your model is not initialized properly at
startup. In Pylons, environment.py would call
init_model(config["sqlalchemy.engine"]) . TG may do it differently,
and middleware such as Repoze.who would have to be initialized their
own way, usually in middleware.py or the equivalent.
Looking through the traceback, we see that execution went through TG,
Repoze.who, and then SQLAlchemy (according to the module paths). So
Repoze.who made the query.
--
Mike Orr <[email protected]>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.