[Zope-CMF] Re: [dev] newstyle content creation

yuppie y.2008 at wcm-solutions.de
Fri Apr 25 03:23:17 EDT 2008


Charlie Clark wrote:
> Okay. Had a quick look your implementation and I think I understand it! 8-)
> Had trouble with createAndAdd and finishCreate but now I understand 
> them. Shouldn't there be default finishCreate in the ContentAddFormBase 
> so that it's obvious we have to overwrite it?

I simplified the code in ContentAddFormBase.create and moved it to the 
add view. 'finishCreate' no longer exists, your add view has to 
implement the complete 'create' method. Formlib raises an 
NotImplementedError if 'create' is missing.

This requires a few more lines of code in add views for real 
IDynamicType content. If you hardcode factory and portal_type in the 
view, the code becomes much simpler. And if the __init__ method of your 
content type handles unicode and datetime correctly, 'create' can be a 
single line.

> It's taken me such a while 
> to get my head around the ProxyFieldProperty stuff that I've made all my 
> new content stuff work without it but I can see you've used it 
> elegantly.

You should not use that stuff if you don't need it. Schema adapters and 
ProxyFieldProperty are just legacy code for old content types.

> I also understand what you mean about making a menu for this 
> stuff. It would be nice to have some configuration for this so that we 
> don't have to rely on actions such as AddFile, AddImage, etc. Would that 
> be something like listing all views that provide a specific interface?

No. The view registrations don't provide enough information and I'd like 
to keep this configurable TTW.

We can look up the addable types in the types tool as folder_factories 
and Plone do. But in that case we need a way to get the URL of the add 



More information about the Zope-CMF mailing list