Comment 3 for bug 620608

Revision history for this message
ToniMueller (support-oeko) wrote :

Using zcml.condition requires z3c.form to provide the appropriate features. The following patch does this:

--- configure.zcml.orig 2010-10-21 15:24:05.000000000 +0200
+++ configure.zcml 2010-10-21 15:40:58.000000000 +0200
@@ -1,6 +1,7 @@
 <configure
     xmlns="http://namespaces.zope.org/zope"
     xmlns:i18n="http://namespaces.zope.org/i18n"
+ xmlns:meta="http://namespaces.zope.org/meta"
     i18n_domain="z3c.form">

   <!-- default z3c.form layer -->
@@ -9,6 +10,8 @@
       type="zope.publisher.interfaces.browser.IBrowserSkinType"
       />

+ <meta:provides feature="z3c.form.checkbox-widget" />
+ <meta:provides feature="z3c.form.radio-widget" />

   <!-- Validators -->
   <adapter

After that, one can ask for these features in the configure.zcml of collective.singing. Because I'm lazy, I only checked for one feature, and put both widgets into one zcml file:

$ cat oldz3cform.zcml
  <z3c:widgetTemplate
      mode="hidden"
      widget="z3c.form.interfaces.ICheckBoxWidget"
      layer="z3c.form.interfaces.IFormLayer"
      template="checkbox_hidden.pt"
      />

  <z3c:widgetTemplate
      mode="hidden"
      widget="z3c.form.interfaces.IRadioWidget"
      layer="z3c.form.interfaces.IFormLayer"
      template="checkbox_hidden.pt"
      />

$ diff -uw configure.zcml.orig configure.zcml
--- configure.zcml.orig 2010-10-21 15:35:14.000000000 +0200
+++ configure.zcml 2010-10-21 15:34:16.000000000 +0200
@@ -1,24 +1,14 @@
 <zope:configure
    xmlns:zope="http://namespaces.zope.org/zope"
     xmlns:z3c="http://namespaces.zope.org/z3c"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
     xmlns="http://namespaces.zope.org/browser">

-</zope:configure>
- <z3c:widgetTemplate
- mode="hidden"
- widget="z3c.form.interfaces.ICheckBoxWidget"
- layer="z3c.form.interfaces.IFormLayer"
- template="checkbox_hidden.pt"
- />
-
- <z3c:widgetTemplate
- mode="hidden"
- widget="z3c.form.interfaces.IRadioWidget"
- layer="z3c.form.interfaces.IFormLayer"
- template="checkbox_hidden.pt"
- />
+ <include file="oldz3cform.zcml"
+ zcml:condition="not-have z3c.form.checkbox-widget" />

   <zope:adapter
      factory=".converters.DynamicVocabularyCollSeqConverter"
      />

+</zope:configure>

$

With these changes, I can now fire up a Plone 4 server with collective.dancing 0.9 installed. I've not checked with older versions, though.