[Product-Developers] Python content type creation

francoise fcodvpt at gmail.com
Fri Jul 10 15:39:03 UTC 2009


Hello,

Thanks to your help and to the following HowTo 
     
http://plone.org/products/scrawl/documentation/how-to/migrating-news-items-to-scrawl-blog-entries/
Plone 3 python Content type creation become clearer.

However, some things remain confusing.

I can find the parameters specifics to each content type in their schema
found in ATContentType/content

I saw the Dublin Core schema in Archetypes/ExtensibleMetadata.py

Just speaking of Dublin Core metadata, it seems that :
  - some parameters can be set by invokeFactory() for some types
  - some parameters can be set by item.update () for some types, e.g,
"modification_date" can be set for Document but not for News and Events
  - some parameters must be set by item.editMetadata() e.g "subject" for
Events
  - some parameters must be set using the setter, i.e
item.setModificationDate() then item.indexObject() for News and Events

How can I know for a metadata parameter which method I should use ?

It seems the order of the call are important (after invokeFactory) :
  1. call item.editMetadata()
  2. call item.update()
  3. call item.setter()
  4. call item.indexObject()

The best pratice is to create objects with minimal information invokeFactory
(Type, Id) then set parameters with update() or other methods if update()
does not work ?

remark : 
For Event, if I set the title in invokeFactory() it works but if I call
update() without passing the title, the title is empty. Is it normal ?

Sorry I did not found this information in the Archetype developper manual.

Best regards
-- 
View this message in context: http://n2.nabble.com/Python-content-type-creation-tp3236804p3236804.html
Sent from the Product Developers mailing list archive at Nabble.com.




More information about the Product-Developers mailing list