Hi,
Why does TestController (models/__init__.py) use paste.deploy.loadapp,
whereas make_app in config/middleware.py uses pylons.config.make_app with
what looks like a wrapper around paste.deploy?
I'm trying to debug why my test suite doesn't properly initialise a
connection to the database, whereas running a development site under 'paster
serve' does work; I've basically copied Ben's example from the SQLAlchemy +
pagination thread to put the following in BaseController.__call__() :
def __call__(self, action, **params):
# Insert any code to be run per request here
print "basecontroller call"
# Connect the ORM to the database
sqlalchemy.global_connect(g.pylons_config.app_conf['dburi'])
# clear the objectstore session
sqlalchemy.objectstore.clear()
# Use FormEncode to decode the request args automagically
if m.request_args:
m.request_args = variable_decode(m.request_args)
# Let the base class defer to controller actions
Controller.__call__(self, action, **params)
which as you'd expect works fine, but for some reason every call to
SQLAlchemy from within the test suite returns an exception:
File
"/home/jaq/lib/python2.3/SQLAlchemy-0.1.6-py2.3.egg/sqlalchemy/ext/proxy.py",
line 115, in get_engine
raise AttributeError('No connection established')
AttributeError: No connection established
So far my adventures into the guts of Pylons leads me to think that this
difference in the way the app is created has a large part to play here.
Any ideas why the test suite is set up to use a different app creation
method than normal deployment?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---