[Zope-dev] Re: straighting out the SQLAlchemy integration mess

Andreas Jung lists at zopyx.com
Fri Apr 11 07:21:45 EDT 2008



--On 11. April 2008 10:09:16 +0200 Brian Sutherland 
<brian at vanguardistas.net> wrote:

> On Fri, Apr 11, 2008 at 05:07:56AM +0200, Andreas Jung wrote:
>> --On 10. April 2008 21:29:43 +0200 Brian Sutherland
>> <brian at vanguardistas.net> wrote:
>>> What defines if something is the instance configuration?
>>>
>>> Isn't ZCML just another format of configuration file? I agree it's evil
>>> to hardcode database connections in the application as they must be
>>> under the control of the sysadmin. But that doesn't preclude them from
>>> being expressed in zcml.
>>
>> The point is: we don't need yet another configuration language for the
>> configuration of a site. ZCML should be used for the purpose it has been
>> intended for: for the configuration of the components of your site
>> (easily  spoken). This kind of configuration is static if you setup a
>> site for  project X. But settings like ports, paths etc. often differ
>> between dev,  test and production environments.
>>
>> We already have ZConfig as standard cofniguration language for instance
>> specific configuration aspects. In addition: we often do use environment
>> variables and .ini files for additional configurations. Introducing
>> another  configuration language is stupid. Especially because system
>> administrators  or co-workers know little or nothing about ZCML. This is
>> an unnecessary  introduction of complexity. Setting an environment
>> variable with a DSN is  much easier then having to fiddle around with
>> ZCML and XML...totally  unnecessary overhead....keep it simple ...using
>> ZCML in this configuration  context is only for XML masochists.
>
> 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.

> 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..

Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080411/7b3d4707/attachment.bin


More information about the Zope-Dev mailing list