On Fri, Apr 11, 2008 at 01:21:45PM +0200, Andreas Jung wrote:
Unfortunately, it doesn't seem an option, right now, to avoid using ZCML to setup database connections. So I'm not sure how you want to implement your ideas?
I have no need for ideas to be implemented. We're using SA within in several large projects based on z3c.sqlalchemy. And nothing beats the simplicity of of an .ini file or an environment variable.
I see. I suppose you could also write a zcml declaration to pluck out the database config from an environment variable and register a utility.
In general, I think if you want your configuration expressed in ZConfig and available as a utility, you have a problem.
I'm not sure of: * How do I register a utility in ZConfig?
z3c.sqlalchemy provides a method for registering a SA connection as a named utility. This code is usually called during the startup phase of Zope within the related initialize() methds of our products. The DSN are acquired from well-known environment variables...this just works - easy, simple, reliable.
* How will the above registration work properly in functional tests (especially with tearing down and setting up layers)?
Functional tests in our company are tests done by humans. Why? Our applications are very complex with lots of dependencies. Not speaking of lots of involved databases, big storages..
I try do what I can... which is relatively minimal. At least some components are thoroughly tested with the parts of the db schema they depend on. -- Brian Sutherland