Hi Reinhold,

schoolbell.app.browser.cvsimport.py

and I use the following:

def addObject(container, name, factory, **kwargs):
    """Creates and add object to container"""

    # precondition may be necessary

    content = removeAllProxies(zapi.createObject(factory,**kwargs))
    notify(ObjectCreatedEvent(content))

    checkObject(container, name, content)

    chooser = INameChooser(container)
    if IContainerNamesContainer.providedBy(container):
        # The container picks its own names.
        # We need to ask it to pick one.
        if not name:
            name = chooser.chooseName(u'', content)
        # a name given - just check it
        else:
            chooser.checkName(name,container)
    else:
        chooser.checkName(name, container)

    container[name] = content

    event = ObjectAddedEvent(content)
    # tiks.initializer specific action
    InitializationHandler(event)

    return container[name]

Best regards,
Darryl


On Thu, 2006-03-02 at 09:03 +0000, Reinhold Strobl wrote:
> Hi, 
> 
> i am searching for a possibility to create and remove content objects in 
> Python
> Code. 
> Thanks for replies,
> 
> 
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to