assigning db engine dynamically/conditionally in tests

robert rottermann <[email protected]> Fri, 16 Jan 2009 07:10:38 +0100
Newsgroups gmane.comp.web.zope.database
Organization redcor AG
Message-ID <[email protected]>
Hi there,
I am using z3c.saconfig and zope.sqlalchemy to access an relational db.

Now I would like to use a different db schema for the test than for the "real
thing".
I am usin a zcml stanza to define the the db:
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:db="http://namespaces.zope.org/db"
i18n_domain="energiecluster">

  <db:engine name="addresses.database" url="mysql://root@localhost/energie_3" />
  <db:session name="energiecluster.addresses" engine="addresses.database" />

</configure>

here my questions:
Is there a way to load such a stanza conditionally?

or can I just assign a new new engine to a session?

or is there an other way to achieve my goal?

thanks
robert