[Zope-CMF] Formlib for folders
Charlie Clark
charlie at begeistert.org
Tue Mar 11 12:21:42 EDT 2008
Am 13.02.2008 um 23:14 schrieb Charlie Clark:
> BTW. this is probably academic but I noticed the top of the types.py
> is
> from zope.app.schema.vocabulary import IVocabularyFactory
> Is there a reason for not importing the interface directly?
I've finally got some initial code for this.
def contentTypeVocabulary(context):
type_infos = context.allowedContentTypes()
types = [SimpleTerm(t.id, t.id, t.Title()) for t in type_infos]
return SimpleVocabulary(types)
ContentTypeVocabularyFactory = Factory(ContentTypes)
Unless I'm very much mistaken the action for adding an item to a
folder can be achieved by something like the following:
def _handle_success(self, action, data):
id = data['id']
type_name = data['content_types']
self.context.invokeFactory(type_name, id)
Although I'm not quite sure on handling the redirection to the newly
created object.
Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
More information about the Zope-CMF
mailing list