Using z3c.form 2.4.1 in S&D

Bug #620608 reported by Daniel Widerin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Singing & Dancing
Fix Released
High
Daniel Widerin

Bug Description

I tried to run S&D with latest version of z3c.form with Plone 4.
Zope raises ConfigurationConflictError, because collective.singing adds z3c:widgetTemplates for radio and checkbox widgets which are already part of later z3c.form releases. Splitting up into different zcml files and providing a feature we could check on using zcml:condition would be a nice solution to work with both, old and new z3c.form library.

Revision history for this message
Toni Mueller (support-oeko-net) wrote :

I'm also running into this problem, but fortunately, I only need Plone4 compatibility at this point.

Revision history for this message
Toni Mueller (support-oeko-net) wrote :

Quick fix for Plone4 only: Delete the two offending registrations in collective.singing-0.6.15-py2.6.egg/collective/singing/browser/configure.zcml.

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.

Revision history for this message
Daniel Nouri (daniel.nouri) wrote :

I'd say we just drop support for older versions of z3c.form. Can we find out which version introduced the widgets in question, and just require that as a minimum version in setup.py? Still might want to leave oldz3cform.zcml around for people who like to tinker.

Revision history for this message
Daniel Widerin (saily) wrote :

I'll modify the collective.singing/browser/configure.zcml the next days on trunk and will add a new old_z3cform.zcml which includes these widget template registrations. We have to update the documentation when chaning this (see #456383) because most people will claim about non-working s&d installation after updating to a new release.

Changed in singing-dancing:
importance: Undecided → High
assignee: nobody → Daniel Widerin (saily)
status: New → Confirmed
status: Confirmed → In Progress
Daniel Widerin (saily)
Changed in singing-dancing:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.