Enabling a behavior breaks custom content-type

i have a registered custom content-type, and an add-on that wants to enable a custom behavior on that type.

The type is registered like this and works fine.

In the add-on (a different package), i wants to add a new behavior to that type:

<?xml version="1.0"?>
    meta_type="Dexterity FTI"
    <property name="behaviors" purge="false">
        <element value="my.super.behavior />

If i enable the behavior from control-panel, everything goes well, but if try to install the add-on with that xml, my content-type:

  • disappears from "Dexterity types" control panel
  • remains in portal_types with the new behavior enabled

if i try to add a new item, i have a:

ComponentLookupError: (<InterfaceClass plone.dexterity.interfaces.IDexterityFTI>, 'ERNews')

The strange thing is that if i try to do the same thing (enable this behavior with install profile) for Document, this one works like a charm.

I suppose that there is something wrong in my content-type registration because for standard types i don't have problems, but i can't find the problem..any idea?

I'm not sure what's going wrong, but here's the code that is supposed to register that component, in case it helps for debugging: https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/fti.py#L454

that message means that plone.dexterity is not being registered; are you including plone.app.dexterity in your configure.zcml file?

I know, and it's strange because plone.dexterity should be registered (otherwise nothing will work)..i'm on a Plone 5.1 btw.
Reinstalling my dx-addon, the content-type returns available.

I made some other tests and on a new clean site, i don't have this kind of problem.
I think that i fucked up something in my development site that makes this inconsistent situation reinstalling my addon with behavior.

it has to be something very silly and those are the worst things to debug; good luck :slight_smile:

I have a feeling you forgot to import something for you content type.

Does it work if you

  1. Remove the behavior from your content type
  2. Install and add your content type to the site
  3. Add content (your type)
  4. Enable bahavior for your type
  5. Add your-content

Another suggestion

  1. Add your content type TTW
  2. Export it
  3. copy the xml-code to your_type.xml