[Product-Developers] Re: Python-created content has no title. Permissions?
Johannes Schwenk
johannes.schwenk at gmail.com
Fri Mar 26 18:41:30 UTC 2010
Replying to myself.
I found out, that after calling
typestool.constructContent(type_name="MyType",
container=v,
id=vid,
title=subj)
I have to do
v[vid].setTitle(subj)
v[vid].reindexObject()
if I want the newly created object to be found and the Title to be
displayed correctly!
That is strange, because if I create a simple Folder via
constructContent, these additional steps are not necessary. Has someone
a clue what could be missing in my product?
Thanks,
Johannes
Am Mittwoch, den 24.03.2010, 19:01 +0100 schrieb Johannes Schwenk:
> Hello everyone,
>
> I need some help figuring out what is wrong with my code of an
> Archetypes based content type I am writing.
>
> I have something like this in one of my content types (MyType2):
>
> typestool = getToolByName(obj, 'portal_types')
> v = aq_parent(aq_inner(obj)).content
> vid = v.generateUniqueId("MyType")
> typestool.constructContent(type_name="MyType",
> container=v,
> id=vid,
> title=subj)
>
> I have this in a loop over the values of a LinesField newly assigning
> subj for every iteration.
>
> The whole point of this, is automated creation of content every time an
> object of MyType2 is changed.
>
> So I have an object1 of type MyType2. I am modifying object1: on save,
> object2 of type MyType is created inside a special Folder (also of type
> MyType)
>
> This all works well, if I am Manager.
>
> The *Problem*:
>
> If I only have the local roles (u'Contributor', u'Editor', u'Reader') on
> both object1 and the special folder, the created object is missing the
> title!
>
> This is very strange... Any thoughts?
>
> Johannes
>
More information about the Product-Developers
mailing list