Hi,
I develop a TG2.0 application with authentication.
Sometimes (frequently; before solving this I can not step further) I get
the error:
InvalidRequestError: SQL expression, column, or mapped entity expected -
got '<class 'rbcdb.model.Mauth.User'>'
1. I have my User, Group, Permission in rbcdb/model/Mauth.py
2. I import them in rbcdb/model/__init__.py
# Import your model modules here.
from rbcdb.model.Mauth import User, Group, Permission, Token
from rbcdb.model.Entities import *
1. I can login;
2. I can access protected pages;
3. However, sometimes I get the above error.
It seems that I get this error, if some authentication data have to be
stored in cookies - I am not sure. It happens if some other error
happens, looking the debug page and then try to go back or refresh. Or
if time goes, I leave for a drink (I am not sure of this).
Below you see the text output and some portion of the interactive output
(the letter one is not a consecutive part of the output, it is what I
thought being important).
Thanks for any idea and suggestion!
Tamas
------------------------------------------------------
URL: http://10.114.104.74:8099/addAnnotation
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/WebError-0.10.1-py2.5.egg/weberror/evalexception.py',
line 431 in respond
app_iter = self.application(environ, detect_start_response)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/TurboGears2-2.0.3-py2.5.egg/tg/configuration.py',
line 655 in wrapper
return app(environ, start_response)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/TurboGears2-2.0.3-py2.5.egg/tg/configuration.py',
line 555 in remover
return app(environ, start_response)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/repoze.tm2-1.0a4-py2.5.egg/repoze/tm/__init__.py',
line 19 in __call__
result = self.application(environ, save_status_and_headers)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/repoze.who-1.0.15-py2.5.egg/repoze/who/middleware.py',
line 85 in __call__
self.add_metadata(environ, classification, identity)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/repoze.who-1.0.15-py2.5.egg/repoze/who/middleware.py',
line 179 in add_metadata
plugin.add_metadata(environ, identity)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/repoze.who.plugins.sa-1.0rc1-py2.5.egg/repoze/who/plugins/sa.py',
line 154 in add_metadata
identity['user'] = self.get_user(identity['repoze.who.userid'])
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/repoze.who.plugins.sa-1.0rc1-py2.5.egg/repoze/who/plugins/sa.py',
line 52 in get_user
query = self.dbsession.query(self.user_class)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.6.6-py2.5.egg/sqlalchemy/orm/scoping.py',
line 139 in do
return getattr(self.registry(), name)(*args, **kwargs)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.6.6-py2.5.egg/sqlalchemy/orm/session.py',
line 858 in query
return self._query_cls(entities, self, **kwargs)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.6.6-py2.5.egg/sqlalchemy/orm/query.py',
line 107 in __init__
self._set_entities(entities)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.6.6-py2.5.egg/sqlalchemy/orm/query.py',
line 114 in _set_entities
entity_wrapper(self, ent)
File
'/home/hegedus/mypy/tg2env/lib/python2.5/site-packages/SQLAlchemy-0.6.6-py2.5.egg/sqlalchemy/orm/query.py',
line 2711 in __init__
"expected - got '%r'" % column
InvalidRequestError: SQL expression, column, or mapped entity expected -
got '<class 'rbcdb.model.Mauth.User'>'
Module repoze.who.plugins.sa:52 in get_user
self <repoze.who.plugins.sa.SQLAlchemyUserMDPlugin object at 0x2616190>
username 'hegedus'
username_attr Property(user_name, <class 'rbcdb.model.Mauth.User'>)
Module sqlalchemy.orm.query:107 in __init__
entities (<class 'rbcdb.model.Mauth.User'>,)
self <sqlalchemy.orm.query.Query object at 0x2805d10>
session <sqlalchemy.orm.session.Session object at 0x2805390>
view
<< self.session = session
self._polymorphic_adapters = {}
self._set_entities(entities)
def _set_entities(self, entities, entity_wrapper=None):
>> self._set_entities(entities)
Module sqlalchemy.orm.query:114 in _set_entities
ent <class 'rbcdb.model.Mauth.User'>
entities (<class 'rbcdb.model.Mauth.User'>,)
entity_wrapper <class 'sqlalchemy.orm.query._QueryEntity'>
self <sqlalchemy.orm.query.Query object at 0x2805d10>
view
<< self._entities = []
for ent in util.to_list(entities):
entity_wrapper(self, ent)
self._setup_aliasizers(self._entities)
>> entity_wrapper(self, ent)
Module sqlalchemy.orm.query:2711 in __init__
column <class 'rbcdb.model.Mauth.User'>
query <sqlalchemy.orm.query.Query object at 0x2636550>
self <sqlalchemy.orm.query._ColumnEntity object at 0x26365d0>
view
<< raise sa_exc.InvalidRequestError(
"SQL expression, column, or mapped entity "
"expected - got '%r'" % column
)
>> "expected - got '%r'" % column
InvalidRequestError: SQL expression, column, or mapped entity expected -
got '<class 'rbcdb.model.Mauth.User'>'
--
Tamas Hegedus, PhD
phone: (36) 1-459 1500/60233
fax: (36) 1-266 6656
mailto: [email protected]
url: http://www.hegelab.org
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.