ATCTContent创建了错误的ID和标题

jdi*_*zio 1 field plone archetypes

我已经用几个ATCTContent创建了一个附加组件,所有这些都是用paster addcontent contenttype.除了一个,所有GearContent工作都按预期工作.只有当我创建GearContent的实例时,他们才会收到诸如gear,gear-1等名称,忽略标题.在默认视图中,H1标签始终为"Gear",但标题如下所示.

尝试更改文件夹内容视图上的ID和标题不会执行任何操作.没有错误消息.

目录也是如此.GearContent的Title元数据是所有实例的"Gear".它适用于所有其他类型.

GearContent只能在GearFolder中添加.其他内容有类似的限制,工作正常.我正在使用plone 4.0.4.

我可以做些什么来使新实例获得正确的标题?

在content/gearcontent.py下面:

 """Definition of the Gear Content content type
 """

 from zope.interface import implements

 from Products.Archetypes import atapi
 from Products.ATContentTypes.content import base
 from Products.ATContentTypes.content import schemata

 # -*- Message Factory Imported Here -*-
 from levity7.gears import gearsMessageFactory as _

 from levity7.gears.interfaces import IGearContent
 from levity7.gears.config import PROJECTNAME

 GearContentSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

     # -*- Your Archetypes field definitions here ... -*-

     atapi.StringField(
         'title',
         storage=atapi.AnnotationStorage(),
         widget=atapi.StringWidget(
             label=_(u"Title"),
             description=_(u"Name for this content."),
         ),
         required=True,
     ),


     atapi.ReferenceField(
         'activities',
         storage=atapi.AnnotationStorage(),
         widget=atapi.ReferenceWidget(
             label=_(u"Adventure Activities"),
             description=_(u"Select all activities that apply to this content."),
         ),
         required=True,
         relationship='gearcontent_activities',
         allowed_types=('Gear Activity'), # specify portal type names here ('Example Type',)
         multiValued=True,
     ),


     atapi.ReferenceField(
         'category',
         storage=atapi.AnnotationStorage(),
         widget=atapi.ReferenceWidget(
             label=_(u"Category"),
             description=_(u"Select a category for this content."),
         ),
         required=True,
         relationship='gearcontent_category',
         allowed_types=('Gear Category'), # specify portal type names here ('Example Type',)
         multiValued=False,
     ),


     atapi.ImageField(
         'image',
         storage=atapi.AnnotationStorage(),
         widget=atapi.ImageWidget(
             label=_(u"Image"),
             description=_(u"A picture of this content."),
         ),
         validators=('isNonEmptyFile'),
     ),


     atapi.StringField(
         'imageLink',
         storage=atapi.AnnotationStorage(),
         widget=atapi.StringWidget(
             label=_(u"Image Link"),
             description=_(u"An URL to the image of this content."),
         ),
         validators=('isURL'),
     ),


     atapi.TextField(
         'description',
         storage=atapi.AnnotationStorage(),
         widget=atapi.RichWidget(
             label=_(u"Description"),
             description=_(u"Description for the content."),
         ),
         required=True,
     ),


     atapi.StringField(
         'reviewLink',
         storage=atapi.AnnotationStorage(),
         widget=atapi.StringWidget(
             label=_(u"Review Link"),
             description=_(u"Link to Review page."),
         ),
         validators=('isURL'),
     ),


     atapi.StringField(
         'diyLink',
         storage=atapi.AnnotationStorage(),
         widget=atapi.StringWidget(
             label=_(u"DIY Link"),
             description=_(u"Link to DIY page."),
         ),
         validators=('isURL'),
     ),


     atapi.TextField(
         'commentary',
         storage=atapi.AnnotationStorage(),
         widget=atapi.TextAreaWidget(
             label=_(u"commentary"),
             description=_(u"commentarys for the content. These will not be displayed."),
         ),
     ),


     atapi.TextField(
         'purchaseHtml',
         storage=atapi.AnnotationStorage(),
         widget=atapi.TextAreaWidget(
             label=_(u"Purchase HTML Code"),
             description=_(u"HTML used to display or add this item to the Cart."),
         ),
     ),


     atapi.IntegerField(
         'score',
         storage=atapi.AnnotationStorage(),
         widget=atapi.IntegerWidget(
             label=_(u"Life This Value"),
             description=_(u"Initial value of 'Life This'"),
         ),
         default=_(u"0"),
         validators=('isInt'),
     ),


 ))

 # Set storage on fields copied from ATContentTypeSchema, making sure
 # they work well with the python bridge properties.

 GearContentSchema['title'].storage = atapi.AnnotationStorage()
 GearContentSchema['description'].storage = atapi.AnnotationStorage()

 schemata.finalizeATCTSchema(GearContentSchema, moveDiscussion=False)


 class GearContent(base.ATCTContent):
     """Gear Content"""
     implements(IGearContent)

     meta_type = "GearContent"
     schema = GearContentSchema

     title = atapi.ATFieldProperty('title')
     description = atapi.ATFieldProperty('description')

     # -*- Your ATSchema to Python Property Bridges Here ... -*-
     title = atapi.ATFieldProperty('title')

     activities = atapi.ATReferenceFieldProperty('activities')

     category = atapi.ATReferenceFieldProperty('category')

     image = atapi.ATFieldProperty('image')

     imageLink = atapi.ATFieldProperty('imageLink')

     description = atapi.ATFieldProperty('description')

     reviewLink = atapi.ATFieldProperty('reviewLink')

     diyLink = atapi.ATFieldProperty('diyLink')

     commentary = atapi.ATFieldProperty('commentary')

     purchaseHtml = atapi.ATFieldProperty('purchaseHtml')

     score = atapi.ATFieldProperty('score')


 atapi.registerType(GearContent, PROJECTNAME)
Run Code Online (Sandbox Code Playgroud)

谢谢.

Ste*_*veM 5

删除"标题"字段.它已在ATContentTypeSchema中定义.您正在有效地重新实现它,但没有像自动内容对象命名这样的基线功能.你的人正在掩饰Archetypes中定义的那个.