Re: Plone Content Typ programmatisch erstellen (ArrayField)

robert rottermann <[email protected]>
Newsgroups gmane.comp.web.zope.german
Organization redCOR AG
Message-ID <[email protected]>
ich würe nicht invokeFactory nutzen, sondern
portal_types.constructContent (oder so).
das sähe dann in etwa so aus:
new_id = portal_types.constructContent ("MyContentType", container, id ..)
new_obj = container[new_id]
for feld in alle meine felder:
  new_obj.setzeFeld(wert ..)

robert
Nico Grubert schrieb:
> Hallo zusammen
>
> Angenommen, ich habe folgenden Content-Typen für Plone 3 definiert:
>
> mycontenttypeSchema = schemata.ATContentTypeSchema.copy() +
> atapi.Schema((
>   atapi.StringField('images',
>       widget=atapi.StringWidget(label=u"Images",),
>       ),
>
> Eine Instanz dieses Content-Typen in Plone kann man programmatisch
> dann ja wie folgt anlegen:
>
>   obj.invokeFactory("MyContentType",
>                      id=id,
>                      title=title,
>                      images=images,
>                     )
>
>
> Wie müsste der Aufruf zum Anlegen aussehen, wenn 'images' nun nicht
> ein StringField wäre, sondern ein ArrayField der folgenden Form:
>
> mycontenttypeSchema = schemata.ATContentTypeSchema.copy() +
> atapi.Schema((
> ArrayField(CompoundField(name='images', Schema=atapi.Schema((
>    atapi.ImageField(name='image',
>        label=u'Image',
>        searchable = False,
>        required = False,
>        max_size = (125, 125),
>        allowable_content_types = ('image/gif',
>                                   'image/jpeg',
>                                   'image/png'),
>        widget = atapi.ImageWidget(label = u'Image'),
>        ),
>    atapi.StringField(name='imagetitle', maxlength = 30,
>                      label = u'Imagetitle'),
>    atapi.TextField(name='imagetext',
>                    label = u'Textblock',
>                    default_output_type = 'text/x-html-safe',
>                    widget = atapi.RichWidget(rows = 3),
>                    ),
>  ),),
> ),
>
>
> Hat jemand so etwas schon mal gemacht und einen Tip für mich?
>
> Gruss & Danke im voraus
> Nico
>
>
> _______________________________________________
> zope mailing list
> [email protected]
> https://mail.dzug.org/mailman/listinfo/zope
>
>



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.