2012-01-20 8 views
3

私のconfigure.zcmlファイルに次のコードがあります。私は私のクラスがあまりにも別のインターフェイスのために実装することにしたい、私は私のZCMLファイルでこれを宣言するにはどうすればよいのはInterface2Zope3ブラウザ:page multiple interfaces

<browser:page 
     for="Interface1" 
     class="plone.app.content.browser.reviewlist.FullReviewListView" 
     name="full_review_list" 
     template="document_full_review_list.pt" 
     permission="cmf.ReviewPortalContent" /> 

を言わせて?

は長いので、私はfolowingを試してみました:

<browser:page 
     for="Interface1 Interface2" 
     class="plone.app.content.browser.reviewlist.FullReviewListView" 
     name="full_review_list" 
     template="document_full_review_list.pt" 
     permission="cmf.ReviewPortalContent" /> 

<browser:page 
     for="Interface1" 
     allowed_interface="Interface2" 
     class="plone.app.content.browser.reviewlist.FullReviewListView" 
     name="full_review_list" 
     template="document_full_review_list.pt" 
     permission="cmf.ReviewPortalContent" /> 

答えて

6

あなたは一度、各インターフェイスのため、二度それを登録する必要があります。たBrowserView特定のインターフェイス(すなわちインターフェース1又はインターフェイス2)を提供するオブジェクトと要求の両方を適応させるという名前のマルチアダプターあるので

名は、ConfigurationConflictErrorを得ることなく、同じであってもよいです。

オブジェクトが提供するはずのインターフェイスがブラウザビュー登録ごとに異なる場合、競合はありません。

<browser:page 
     for="Interface1" 
     class="plone.app.content.browser.reviewlist.FullReviewListView" 
     name="full_review_list" 
     template="document_full_review_list.pt" 
     permission="cmf.ReviewPortalContent" /> 

<browser:page 
     for="Interface2" 
     class="plone.app.content.browser.reviewlist.FullReviewListView" 
     name="full_review_list" 
     template="document_full_review_list.pt" 
     permission="cmf.ReviewPortalContent" /> 

逆に、あなたは同じオブジェクト・インタフェースのための(と同じ名前を持つ)が、目の肥えた基準はリクエストにより提供されるインタフェースであることと、2件のたBrowserView登録を持つことができます。これはのレイヤーの属性です。

+0

ありがとう、それは私のために完璧に働いた。 – bogtan