ER: [Zope] Creating a LocalContent object from a Python script
Igor Leturia
IGOR@emun.com
Wed, 12 Mar 2003 10:21:21 +0100
>Igor Leturia wrote at 2003-3-11 17:54 +0100:
> > I need to create a LocalContent object from within a Python
script,
> > and I don't know how to do it. I think the function to be called is
> > manage_addLocalContent, and I try it as if I were adding a file
> > (context.manage_addLocalContent(id, title, languages)) but it says
the
> > function does not exist.
>
>I do not know what a "LocalContent" object is but usually you use:
> destination.manage_addProduct[product_name].constructor(args)
>where "destination" is the destination ObjectManager where the new
>object shoult be placed into,
>"productname" is the name of the product that defines the objects
>class,
>"constructor" is the constructor for this kind of objects
>and "args" are the constructor arguments.
Thanks, Dieter. This has put me on the right way, but I still can't get
it. The LocalContent object is a class from the Localizer product, so I
tried:
=20
container.manage_addProduct('Localizer').manage_addLocalContent('whateve
r_id','en es')
The container is an ObjectManager (a folder, to be precise), Localizer
is the product and manage_addLocalContent is the constructor, which I
think takes two arguments, the id and a string containing the languages.
But it always gives me an error:
Error Type: AttributeError
Error Value: __call__
Troubleshooting Suggestions:
The URL may be incorrect.=20
The parameters passed to this resource may be incorrect.=20
A resource that this resource relies on may be encountering an error.
Any ideas, anybody?
Igor Leturia