[Zope-DB] assigning db engine dynamically/conditionally in tests

robert rottermann robert at redcor.ch
Fri Jan 16 01:10:38 EST 2009


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


More information about the Zope-DB mailing list