Hi there!
In short:
Using Pylons 0.9.5 + SQLAlchemy + SaContext
When running app or tests all is OK.
But after change from pylons.database to sacontext for each 'nosetests
test_*.py' I get a "configuration error" in addition: "AttributeError:
No configuration has been registered for this process or thread" (full
error below)
In long:
I am a new user to Pylons. I do not fully _yet_ understand the whole
framework, but yet in the project we have managed to implement some
quite nice functionality.
I started a month ago with Pylons 0.9.5 and are not willing to upgrade yet.
Nevertheless, initially I was using default pylons.database for
SQLAlchemy, but a week ago I have tried successfully SAContext with
0.9.5 and it works. No major problems overall.
But when I run 'nosetests' for any test, then the test runs fine - all
the SQLAlchemy objects are managed properly, transaction management,
sqla sessions cool - but I always get additional 2 errors for each one
test class (2 errors are the same). Here it is:
<error>
======================================================================
ERROR: test module yyy in F:\xxx\svn\trunk\portal\portal
----------------------------------------------------------------------
Traceback (most recent call last):
File
"c:\programy\python\python24\lib\site-packages\nose-0.9.2-py2.4.egg\nose\suite.py",
line 51, in run
self.setUp()
File
"c:\programy\python\python24\lib\site-packages\nose-0.9.2-py2.4.egg\nose\suite.py",
line 200, in setUp
self.module = _import(self.moduleName, [self.path], self.conf)
File
"c:\programy\python\python24\lib\site-packages\nose-0.9.2-py2.4.egg\nose\importer.py",
line 101, in _import
mod = load_module(fqname, fh, filename, desc)
File "F:\xxx\svn\trunk\portal\portal\models\__init__.py", line 10, in
?
sac.add_engine_from_config(None)
File "F:\xxx\svn\trunk\portal\portal\lib\sacontext.py", line 533, in
add_engine_from_config config_key)
File "F:\xxx\svn\trunk\portal\portal\lib\sacontext.py", line 578, in
parse_engine_options for full_key in config.iterkeys():
File
"c:\programy\python\python24\lib\site-packages\PasteDeploy-1.3.1-py2.4.egg\paste\deploy\config.py",
line 101, in __getattr__
raise AttributeError(
AttributeError: No configuration has been registered for this process or thread
----------------------------------------------------------------------
Ran 1 test in 2.438s
FAILED (errors=2)
</error>
Here is some details of configuration:
-Pylons-0.9.5-py2.4
-sqlalchemy-0.3.8-py2.4
-nose-0.9.2-py2.4
-Paste-1.4-py2.4
-PasteDeploy-1.3.1-py2.4
+ manually downloaded sacontext.py (0.3.3)
And part of my models/__init__.py:
#From 'SQLAlchemy for people in hurry'
import sqlalchemy as sqla
from sqlalchemy.orm import mapper
from portal.lib.sacontext import PylonsSAContext
sac = PylonsSAContext()
sac.add_engine_from_config(None) # <--- LINE 10
#All the businness classes are here..
from portal.models.domain import User
users_t = sqla.Table('users', sac.metadata, autoload=True)
#Etc...
mapper(User, user_t)
#Etc...
The are no modifications to Pylons base classes, configurations or whatever.
Just the necessary ones for using Mako.
config/* are almost original except routing.py,
lib/* the same..
Any ideas?
Tomasz Nazar
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________JKM-UPR
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---