2

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?

zupo
  • 1,556
  • 1
  • 13
  • 17
  • Why do you need to use `overrides.zcml` in the first place? Why not just register this in `configure.zcml`? Don't tell me Quintagroup requires you to override this, that'd be.. shall we say.. shortsighted? – Martijn Pieters Mar 12 '13 at 13:17
  • AFAIU their code, yes, you need to override it as they look for an "import" pipeline and I didn't see anywhere that I could tell q.transmogrifier to use a different pipeline name for importing. – zupo Mar 12 '13 at 13:29
  • 1
    /me buries his head in his hands. – Martijn Pieters Mar 12 '13 at 13:29

1 Answers1

2

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

  • 1
    In the end what I did was to clear() the transmogrifier configuration_registry, just before I loaded the overrides.zcml in my test layer setup. Thanks for the tip! – zupo Mar 13 '13 at 10:16