plonezopetransmogrifierzcml

Overriding transmogrifier:registerConfig without using overrides.zcml


I am using quintagroup.transmogrifier and I'd like to provide my on 'import.cfg' pipeline. Normally, I would put something like this in overrides.zcml:

<include package="collective.transmogrifier" file="meta.zcml" />
<transmogrifier:registerConfig
    name="import"
    title="Import pipeline configuration"
    description="My custom import pipeline."
    configuration="import.cfg"
    />

Several people pointed out that using overrides.zcml is not recommended. Moreover, I am having great troubles loading overrides.zcml in tests -- I get duplicate configuration errors and such. So my question is how do I achieve my task (of providing my own pipeline) without using overrides.zcml?


Solution

  • I think that the reason behind the deprecation of overrides.zcml results from the fact that some black magic is done in order to load them (which you have to replicate in your p.a.testing setup), which is probably done by the zope server in its startup routine.

    Sadly, I am not aware of anything better than going directly on the configuration_registry (located in collective.transmogrifier.transmogrifier, and it's a global). If you call registerConfig directly you should be able to override it, but it's dirtier than using overrides.zcml.

    An alternative might be looking into zope.configuration to see if you can do the override via code...