Hi Hedley,
I've been playing around with dexterity. I have a content type that's
title is supposed to be computed from other fields. I basically need
to (1) not display a title edit widget on the page and (2) still have
a nice id / short name computed.
I've tried a few different permutations without much success. These include
1. My own INameFromTitle behaviour for IMyContentType. I can't get it
to work due to ZCML configuration collisions though.
What you can do is to define your own INameFromTitle *adapter* from your
type's interface (or a marker, which you could set with a behaviour, but
in this case that seems rather like overkill). That just needs to return
the right thing. Look at its interface.
Don't be fooled by behaviours. They're just adapters (with a slightly
unusual mechanism for broadcasting what types of contexts they're
available for). You don't need to write your own behaviours unless you
are trying to provide some functionality for general re-use.
2. My own dexterity Item subclass so I can provide a title attribute.
That should work fine. It's possible that if the title property is
editable, that z3c.form is setting a new value and overwriting your value.
3. def Title, def title (decorated with @property), a title attribute
that is not in the interface schema
That should also work, with the same caveat.
I guess the last bit to explore is z3c.form and try to make the title
invisible and set it with an event handler.
That doesn't sound right either. Either you want the title on the form
or you don't. If it's not in the schema that z3c.form sees, then it's
not going to show up on the form (obviously).
Note that if you just want the title hidden in the form, you can either
avoid using the IBasic behaviour (best idea) or use a form.omitted() hint.
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers