1

私は最近のProfessionalPlone4 Developmentの本で、Plone4.1.2のインストールに取り組んでいます。

Dexterityを介してコンテンツタイプを正常に定義し、現在、タイプの1つに対してカスタムビューを作成しようとしています。スキーマとビューは次のように定義されます。

from zope import schema
from plone.directives import form
from five import grok
from ctcc.contenttypes import CTCCTypesMessageFactory as _

class ITrial(form.Schema):
    """A clinical trial."""

    title = schema.TextLine(
        title = _(u'label_title', default=u'Title'),
        required = True,
    )

    description = schema.Text(
        title=_(u'label_description', default=u'Description'),
        description = _(u'help_description', default=u'A short summary of the content'),
        required = False,
        missing_value = u'',
    )

class View(grok.View):
    grok.context(ITrial)
    grok.require('zope2.View')
    grok.name('view')

タイプのFTIの関連セクションは次のとおりです。ビューFalse

<alias from="(Default)" to="(selected layout)"/>
<alias from="edit" to="@@edit"/>
<alias from="sharing" to="@@sharing"/>
<alias from="view" to="@@view"/>

<action title="View" action_id="view" category="object" condition_expr=""
    url_expr="string:${folder_url}/" visible="True">
    <permission value="View"/>
</action>

そして、ctcc.contenttypes /trial_templates / view.ptにあるテンプレート自体は、タイトルと説明を表示するだけです。

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="ctcc.contenttypes">
<body>

<metal:content-core fill-slot="content-core">
    <metal:content-core define-macro="content-core">

        <div tal:replace="structure context/text/output" />

    </metal:content-core>
</metal:content-core>

</body>
</html>

これらすべてが整った状態でこのタイプのインスタンスにアクセスすると、「ページが見つかりません」というエラーが発生します。何かが新しいビューを期待されたパスに結び付けていないようですが、これはPloneでの最初の週なので、どこからこれを追跡し始めるのかわかりません。フォアグラウンドモードでサイトを実行してもエラーは発生しません。

どんな助けでも大歓迎です。

4

2 に答える 2

2

setup.pyに依存関係を含めましたか?

install_requires=[
  'setuptools',
  'plone.app.dexterity',
  ...
  ],

configure.zcmlでGrokを初期化しましたか?

<configure
  xmlns="http://namespaces.zope.org/zope"
  ...
  xmlns:grok="http://namespaces.zope.org/grok">

  <includeDependencies package="." />
  <grok:grok package="." />
  ...

</configure>

DexterityのGenericSetupプロファイルをmetadata.xmlに含めましたか?

<metadata>
 <version>1</version>
 <dependencies>
  <dependency>profile-plone.app.dexterity:default</dependency>
 </dependencies>
</metadata>
于 2011-10-28T12:49:10.537 に答える
0

問題は、テンプレートの次の行にありました。

<div tal:replace="structure context/text/output" />

サンプルテンプレートを最小限にとどめたものに戻しました。David Glickの提案のおかげで、 error_logの無視された例外リストからNotFoundを削除し、次のように表示されました。

  Module Products.PageTemplates.Expressions, line 225, in evaluateText
  Module zope.tales.tales, line 696, in evaluate
   - URL: /opt/plone41/zeocluster/src/ctcc.contenttypes/ctcc/contenttypes/trial_templates/view.pt
   - Line 13, Column 8
   - Expression: <PathExpr standard:u'context/text/output'>
  [...]
  Module OFS.Traversable, line 299, in unrestrictedTraverse
   - __traceback_info__: ([], 'text')
NotFound: text

何が問題を引き起こしているのかがわかり、TALをさらに深く読み始めたので、なぜ失敗しているのかがわかります。疑われるように、私に代わって無知です。

みんな、ありがとう!

于 2011-10-31T05:24:15.117 に答える