私の敏捷性ベースのカスタムコンテンツタイプの属性( 'sectors')に対して、Sectorsという特殊インデックスを有効にしたいとします。plone.indexerと巧妙な問題
class IMyContent(form.Schema):
"""
My Content
"""
sectors = schema.Set(
title=_(u"Sectors"),
description=_(u"Select some sectors"),
value_type=schema.Choice(vocabulary=vocs.sectors),
required=True,
)
(...)
私はその後、indexers.py最後に
from plone.indexer.decorator import indexer
from zr.content.types.mycontent import IMyContent
@indexer(IMyContent)
def Sectors(obj):
"""Indexer for Sectors attribute.
"""
d = getattr(obj, "sectors", u"")
return d if d else None
で内側に、このようにインデックスを定義します。私が持っているタイプ/ mycontent.pyの内側に私のスキーマで
、ルートパッケージconfigure.zcml:
<adapter name="Sectors" factory=".indexers.Sectors"/>
ただし、動作していないようです。製品を再インストールした後でも、portal_catalogの索引は表示されず、カタログのbrainオブジェクトにも索引が付いていないようです。
私は間違っていますか?
それでも、汎用的な設定で新しいインデックスを追加しないでくださいそれはquick_installerを使用しています。 –
一般的に製品を再インストールすることは間違っているという兆候です。 – MatthewWilkes