For ContentItem (ItemCollections are ContentItems) I've just done something like:

event = CalendarEvent (view=view)

passing in a view, and its worked. I think Morgen hooked this up to work correctly. However, I often find it more convenient to create a template item in the repository with all the attributes (including references to inclusions and exclusions, in the case of ItemCollections) initialized correctly, then just make a copy of the template.

John

Alec Flett wrote:

Right now, we have a way of mapping a repository kind back to a python class - you just say <classes ...>*python class*</classes>

The problem I'm running into now is that I want to create an instance of a python class and an entry in the repository, but I'm not really sure what the proper way is. Specifically, I want to create an ItemCollection, but when I say

c = ItemCollection()

I'm finding that the repository work doesn't get done - the attributes on the object don't get hooked up right, etc. I guess this makes sense though - how would it know which Kind to map the class to?

So, is there a better way to create Items? I see some stuff in Kind, but I can't find any docs on the proper way to create an item of a given kind..

Alec

------------------------------------------------------------------------

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to