Local behavior support for Dexterity


Just created this: https://github.com/inigoconsulting/collective.localbehavior

Back in MyGOSSCon, Dylan Jay of Pretaweb mentioned about his discussion on getting rid of content type concept altogether and replace it with just Deco type.

It sounds to me a lot like having local behavior for Dexterity, where each content may have its own set of behaviors assigned. So you can just add a Dexterity content, and if suddenly you decide you want to add more fields or behaviors, just for that content, you can just assign the local behavior on it.

eg: you added a Page, but suddenly you think that this page should be an event. The main way to do this is to delete the page, and create an Event instead. But with local behavior, your can just assign an Event local behavior and the content will have the fields and viewlets needed to turn it into an event.

If you are interested in above, you might also be interested with this : http://svn.plone.org/svn/collective/collective.miscbehaviors/


Comments

Martin Aspeli said…
Cool. It's written pretty much how I envisaged this would be done, so glad it worked out.

Please consider adding a bit of text to the README file. Also, we should work to change Dexterity so you don't need the monkey patch.

Less impressed by the naming of 'collective.miscbehaviours', though. ;-)

Martin
Dylan Jay said…
As alluded to by martin, the idea of local behaviours is included in the design of deco. see https://github.com/plone/plone.app.page/blob/master/docs/DESIGN.txt

I think what would make this idea more cool is if there was a through the web way of making basic behaviours in the control panel. A basic behaviour would just be a set of fields and an interface, no viewlets or other things a behaviour is capable of.

Unfortunatly there also seems to be an issue with the behaviour UI (local and global) in that its hard to know the the consequence of applying a particular behaviour before you do it. For instance in dexterity adding "name and title" and "basic metadata" together create a double up of fields. If there was a more visual way of showing what fields a behaviour adds for those that add fields, or perhaps just a description for each behaviour? Also when adding fields, there isn't a way to determine the order the fields would appear in this UI. Perhaps a drag and drop sort?

Popular posts from this blog

Tee'ing Python subprocess.Popen output

Announcing PlatoCDP, a Plone distribution for enterprises.

Consolidated community site infrastructure on Plone