0

これは、セットアップなどを説明するこの質問へのフォローアップの質問です。

簡単な要約が必要な人のために:

global.sectionsのビューレットを変更してセカンダリ ナビゲーションを作成しましたportal_view_customizations。現在、1 つの問題を除いて正常に動作しています。

問題

サイトにログインできない、または にアクセスできないようmysite.com/plone_control_panelです。についての Plone に関するエラーが表示されますgetFolderContents

変更された Globalnav TALES:

<tal:sections tal:define="portal_tabs view/portal_tabs"
     tal:condition="portal_tabs"
     i18n:domain="plone">
    <h5 class="hiddenStructure" i18n:translate="heading_sections">Sections</h5>

    <ul id="portal-globalnav"
        tal:define="selected_tab python:view.selected_portal_tab"
        ><tal:tabs tal:repeat="tab portal_tabs"
        ><li tal:define="tid tab/id"
             tal:attributes="id string:portaltab-${tid};
                            class python:selected_tab==tid and 'selected' or 'plain'"
            ><a href=""
               tal:content="tab/name"
               tal:attributes="href tab/url;
                               title tab/description|nothing;">
            Tab Name
            </a></li></tal:tabs></ul>


            <tal:subsections tal:define="isDocument python:getattr(context,'portal_type','') == 'Document';
                                         isFolder python:getattr(context,'portal_type','') == 'Folder';
                                         subitemsDocument python:context.aq_parent.aq_inner.getFolderContents(contentFilter={'portal_type':'Document'});
                                         subitemsFolder python:context.getFolderContents(contentFilter={'portal_type':'Document'});
                                         root_url context/portal_url;
                                         front_url string:${root_url}/front-page;
                                         current_url context/absolute_url;">
              <ul id="subnav" tal:condition="isFolder">
                <tal:subtabsfolder tal:repeat="subitem subitemsFolder">
                <li tal:define="item_url subitem/getURL"
                  tal:attributes="class python:current_url==item_url and 'selected' or 'plain'">
                    <a tal:attributes="href subitem/getURL" tal:content="subitem/Title"/>
                  </li>
                </tal:subtabsfolder>
              </ul>

              <ul id="subnav" tal:condition="isDocument">
                <tal:subtabsdocument tal:repeat="subitem subitemsDocument">
                  <li tal:define="item_url subitem/getURL" 
                    tal:attributes="class python:current_url==item_url and 'selected' or 'plain'">
                    <a tal:attributes="href subitem/getURL" tal:content="subitem/Title"
                      tal:condition="python:front_url != current_url"/>
                  </li>
                </tal:subtabsdocument>
              </ul>
            </tal:subsections>


</tal:sections>

ブラウザ ウィンドウで受信したエラー:

AttributeError('getFolderContents',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: getFolderContents)

私がログから得たもの:

  Module zope.pagetemplate.pagetemplate, line 113, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 220, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: /usr/local/Plone/buildout-cache/eggs/plone.app.layout-2.0.7-py2.6.egg/plone/app/layout/viewlets/portal_header.pt
   - Line 2, Column 4
   - Expression: <StringExpr u'plone.portalheader'>
   - Names:
      {'args': (),
       'container': <PloneSite at /mysite-draft>,
       'context': <PloneSite at /mysite-draft>,
       'default': <object object at 0xb7ee76d8>,
       'here': <PloneSite at /mysite-draft>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb56411c>,
       'request': <HTTPRequest, URL=http://myserver.com/mysite-draft/login_form>,
       'root': <Application at >,
       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xc04898c>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'dan'>,
       'view': <Products.Five.viewlet.viewlet.SimpleViewletClass from /usr/local/Plone/buildout-cache/eggs/plone.app.layout-2.0.7-py2.6.egg/plone/app/layout/viewlets/portal_header.pt object at 0x10c0f9ec>,
       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x10c0fe4c>}
  Module zope.contentprovider.tales, line 80, in __call__
  Module plone.app.viewletmanager.manager, line 154, in render
  Module plone.app.viewletmanager.manager, line 85, in render
  Module five.customerize.zpt, line 143, in render
  Module Products.PageTemplates.ZopePageTemplate, line 335, in _exec
  Module Products.PageTemplates.ZopePageTemplate, line 432, in pt_render
  Module Products.PageTemplates.PageTemplate, line 80, in pt_render
  Module zope.pagetemplate.pagetemplate, line 113, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: /mysite-draft/front-page/zope.interface.interface-plone.global_sections
   - Line 20, Column 12
   - Expression: <PythonExpr context.aq_parent.aq_inner.getFolderContents(contentFilter={'portal_type':'Document'})>
   - Names:
      {'container': <PloneSite at /mysite-draft>,
       'context': <PloneSite at /mysite-draft>,
       'default': <object object at 0xb7ee76d8>,
       'here': <PloneSite at /mysite-draft>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xf66a824>,
       'request': <HTTPRequest, URL=http://myserver.com/mysite-draft/login_form>,
       'root': <Application at >,
       'template': <TTWViewTemplate at /mysite-draft/zope.interface.interface-plone.global_sections>,
       'user': <PropertiedUser 'dan'>,
       'view': <five.customerize.zpt.TTWViewlet object at 0xd6e274c>}
  Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
   - __traceback_info__: context.aq_parent.aq_inner.getFolderContents(contentFilter={'portal_type':'Document'})
  Module PythonExpr, line 1, in <expression>
AttributeError: getFolderContents
------
2013-07-30T10:59:08 ERROR root Exception while rendering an error message
Traceback (most recent call last):
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/OFS/SimpleItem.py", line 254, in raise_standardErrorMessage
    v = s(**kwargs)
  File "/usr/local/Plone/buildout-cache/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/FSPythonScript.py", line 130, in __call__
    return Script.__call__(self, *args, **kw)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Shared/DC/Scripts/Bindings.py", line 324, in __call__
    return self._bindAndExec(args, kw, None)
  File "/usr/local/Plone/buildout-cache/eggs/Products.PloneHotfix20110531-2.0-py2.6.egg/Products/PloneHotfix20110531/__init__.py", line 106, in _patched_bindAndExec
    return self._original_bindAndExec(args, kw, caller_namespace)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Shared/DC/Scripts/Bindings.py", line 361, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PythonScripts/PythonScript.py", line 344, in _exec
    result = f(*args, **kw)
  File "Script (Python)", line 34, in standard_error_message
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Shared/DC/Scripts/Bindings.py", line 324, in __call__
    return self._bindAndExec(args, kw, None)
  File "/usr/local/Plone/buildout-cache/eggs/Products.PloneHotfix20110531-2.0-py2.6.egg/Products/PloneHotfix20110531/__init__.py", line 106, in _patched_bindAndExec
    return self._original_bindAndExec(args, kw, caller_namespace)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Shared/DC/Scripts/Bindings.py", line 361, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/usr/local/Plone/buildout-cache/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 240, in _exec
    result = self.pt_render(extra_context=bound_names)
  File "/usr/local/Plone/buildout-cache/eggs/Products.CMFCore-2.2.2-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 180, in pt_render
    self, source, extra_context
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/PageTemplate.py", line 80, in pt_render
    showtal=showtal)
  File "/usr/local/Plone/buildout-cache/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 888, in do_useMacro
    self.interpret(macro)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 852, in do_condition
    self.interpret(block)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/Expressions.py", line 220, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tales-3.4.0-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
  File "/usr/local/Plone/buildout-cache/eggs/zope.contentprovider-3.5.0-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
  File "/usr/local/Plone/buildout-cache/eggs/plone.app.viewletmanager-2.0.1-py2.6.egg/plone/app/viewletmanager/manager.py", line 154, in render
    return BaseOrderedViewletManager.render(self)
  File "/usr/local/Plone/buildout-cache/eggs/plone.app.viewletmanager-2.0.1-py2.6.egg/plone/app/viewletmanager/manager.py", line 85, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
  File "/usr/local/Plone/buildout-cache/eggs/zope.app.pagetemplate-3.7.1-py2.6.egg/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__
    return self.index(*args, **kw)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/Five/browser/pagetemplatefile.py", line 126, in __call__
    return self.im_func(im_self, *args, **kw)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/Five/browser/pagetemplatefile.py", line 60, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/usr/local/Plone/buildout-cache/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/Expressions.py", line 220, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tales-3.4.0-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
  File "/usr/local/Plone/buildout-cache/eggs/zope.contentprovider-3.5.0-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
  File "/usr/local/Plone/buildout-cache/eggs/plone.app.viewletmanager-2.0.1-py2.6.egg/plone/app/viewletmanager/manager.py", line 154, in render
    return BaseOrderedViewletManager.render(self)
  File "/usr/local/Plone/buildout-cache/eggs/plone.app.viewletmanager-2.0.1-py2.6.egg/plone/app/viewletmanager/manager.py", line 85, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
  File "/usr/local/Plone/buildout-cache/eggs/five.customerize-1.0-py2.6.egg/five/customerize/zpt.py", line 143, in render
    return template._exec(bound_names, args, kwargs)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/ZopePageTemplate.py", line 335, in _exec
    result = self.pt_render(extra_context=bound_names)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/ZopePageTemplate.py", line 432, in pt_render
    result = PageTemplate.pt_render(self, source, extra_context)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/PageTemplate.py", line 80, in pt_render
    showtal=showtal)
  File "/usr/local/Plone/buildout-cache/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 852, in do_condition
    self.interpret(block)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/usr/local/Plone/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 583, in do_setLocal_tal
    self.engine.setLocal(name, self.engine.evaluateValue(expr))
  File "/usr/local/Plone/buildout-cache/eggs/zope.tales-3.4.0-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.12.16-py2.6-linux-i686.egg/Products/PageTemplates/ZRPythonExpr.py", line 49, in __call__
    return eval(self._code, vars, {})
  File "PythonExpr", line 1, in <expression>
AttributeError: getFolderContents

誰でもこれで正しい方向に向けることができますか?

問題は TALES に関連しているaq_inner、および/またはTALES にあると思いますaq_parentが、TALES を使用せずに TALES が達成することを達成する方法がわかりません。

<tal:subsections>匿名ユーザーのナビゲーションのみを表示するために、開始タグで TALES 条件を試してみましたが、それでも同じエラーが発生します。

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

4

1 に答える 1

3

次の式に問題があります。

subitemsDocument python:context.aq_parent.aq_inner.getFolderContents(contentFilter={'portal_type':'Document'});

contextPlone サイトはどこにありますか。Plone サイトの親は Zope ルート オブジェクトですが、getFolderContents()skin メソッドは Plone サイト内にしか存在しません。

コンテキストの親のフォルダーの内容を取得しようとする理由は明らかではありません。ここでサイトのルートにいない場合は、テストする必要がある場合があります。

于 2013-07-30T10:26:43.573 に答える