[Zope-CMF] Add content programmatically

Keller Nicolas nicolas.keller@slb.de
Tue, 28 May 2002 18:18:08 +0200


Hi!

For hours I've tried to accomplish the following: I've got a CMF
product that holds content and acts as an folder. What I want to=20
to now is to add a file (eg. an empty image object) after the object
was created. I think the following code is not totally wrong (at=20
least I hope so for my ego :)) but it always comes up with an=20
"AttributeError: portal_types" - Traceback.

----------------------------- cutting -------------------------------

class CMFExtNews(PortalFolder, PortalContent, DefaultDublinCoreImpl):

    meta_type =3D 'CMFExtNews'

    def __init__(self, id, title=3D''):
        DefaultDublinCoreImpl.__init__(self)
        self.id =3D id
        self.title =3D title
        self.invokeFactory('Image', 'img')      <------ The bad one
   =20
----------------------------- cutting -------------------------------

Without the 'self.invokeFactory('Image', 'img')'-line the product=20
works perfect but I'm really hopeless on this one.

Any hints?

Bye,

Nicolas Keller

___________________________________________
BA Student Wirtschaftsinformatik
Schulthei=DF, Langner & Co GmbH
Tel.: (07223) 989-0 - Fax: (07223) 989-128
mailto:nicolas.keller@slb.de - http://www.slb.de