Plone 2.5xからPlone 3.xへの移行後、kss_generic_macrosの問題を修正するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/1040520

  •  22-07-2019
  •  | 
  •  

質問

いくつかのビューで以下のエラーが表示されます。この他のkss_generic_macros 投稿。回答が提供されます。これは、「2.5〜> 3.0の移行プロセスが少数のカスタムスキンにplone_kssレイヤーを追加できなかったために発生しました。入って、それらのスキンにplone_kssを手で追加すると、これが修正されました。"

これは非常に便利です。コードサンプルまたはplone_kssを追加する場所に関する実際のポインターを使用すると、これを簡単に解決できます。

2009-06-24 15:24:28 ERROR Zope.SiteErrorLog 1245871468.060.103936823493 https://nasascience.on.my.mac/humanator-folder/what-is-six-plus-3/base_view
Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 216, in _exec
  Module Products.CacheSetup.patch_cmf, line 29, in FSPT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.CMFCore.FSPageTemplate, line 155, in pt_render
  Module Products.CacheSetup.patch_cmf, line 77, in PT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.PageTemplates.PageTemplate, line 98, in pt_render
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render
   - Warning: Macro expansion failed
   - Warning: exceptions.KeyError: 'macro'
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 891, in do_useMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 525, in do_optTag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 957, in do_defineSlot
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 861, in do_defineMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 957, in do_defineSlot
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 525, in do_optTag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 949, in do_defineSlot
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 861, in do_defineMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 891, in do_useMacro
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 536, in do_optTag_tal
  Module zope.tal.talinterpreter, line 521, in do_optTag
  Module zope.tal.talinterpreter, line 516, in no_tag
  Module zope.tal.talinterpreter, line 346, in interpret
  Module zope.tal.talinterpreter, line 870, in do_useMacro
  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/Users/danny/projects/schwa/2.1.0a/trunk/eggs/Products.Archetypes-1.5.10-py2.4.egg/Products/Archetypes/skins/archetypes/base.pt
   - Line 22, Column 10
   - Expression: <PathExpr standard:u'here/kss_generic_macros/macros/generic_title_view'>
   - Names:
      {'container': <PloneSite at /msrd>,
       'context': <Humanatorquestion at /msrd/humanator-folder/what-is-six-plus-3>,
       'default': <object object at 0x1bf528>,
       'here': <Humanatorquestion at /msrd/humanator-folder/what-is-six-plus-3>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x9ea75f8>,
       'request': <HTTPRequest, URL=https://nasascience.on.my.mac/humanator-folder/what-is-six-plus-3/base_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /msrd/base_view used for /msrd/humanator-folder/what-is-six-plus-3>,
       'traverse_subpath': [],
       'user': <PloneUser 'admin'>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 155, in _eval
  Module zope.tales.expressions, line 124, in _eval
  Module Products.PageTemplates.Expressions, line 82, in boboAwareZopeTraverse
  Module OFS.Traversable, line 301, in restrictedTraverse
  Module OFS.Traversable, line 269, in unrestrictedTraverse
   - __traceback_info__: ([], 'kss_generic_macros')
AttributeError: kss_generic_macros
役に立ちましたか?

解決

ZMIにログインし、portal_skinsツールに移動します。次に、「プロパティ」をクリックします。タブ。 「デフォルトの複製」スキンは次のようになります。

custom
cmfeditions_views
CMFEditions
ChangeSet
kupu_plone
kupu
kupu_tests
archetypes
archetypes_kss
mimetypes_icons
plone_kss
ATContentTypes
ATReferenceBrowserWidget
ResourceRegistries
PasswordReset
gruf
plone_ecmascript
plone_wysiwyg
plone_prefs
plone_portlets
plone_templates
plone_styles
plone_form_scripts
plone_scripts
plone_forms
plone_images
plone_content
plone_login
plone_deprecated
plone_3rdParty
cmf_legacy

これらのいずれかが欠落している場合は、それらを追加する必要があります。これで問題が解決します。

他のヒント

スキンに plone_kss レイヤーがありません。 ZMIに移動し(サイトのセットアップまたはPloneホームページに/ manageを追加して)、portal_skinsツールを見つけ、プロパティタブでスキンレイヤーを確認します。 plone_kss レイヤーがカスタムレイヤーの前にリストされていることを確認し、移動するように設定する必要があります。

将来、findなどのコマンドラインツールを使用して、不足しているスキンメソッドを見つけることができます。次のコマンドを使用して、ビルドアウトでこれを見つけました:

$ find parts/plone -name kss_generic_macros.*
parts/plone/CMFPlone/skins/plone_kss/kss_generic_macros.pt

次のPythonスクリプトを使用して、これを自動化できます。

from Products.CMFCore.utils import getToolByName
layer = 'plone_kss'
skins = getToolByName(context, 'portal_skins')
for name in skins.getSkinSelections():
    path = skins.getSkinPath(name)
    path = [i.strip() for i in path.split(',')]
    if layer not in path:
        try:
            path.insert(path.index('custom') + 1, layer)
        except ValueError:
            path.append(layer)
        skins.addSkinSelection(name, ','.join(path))

このスクリプトは、スキンツールのすべてのスキンをループし、欠落している場所のいずれかに plone_kss を挿入します。 custom レイヤーの直後、または custom レイヤーが存在しない場合は最後に追加します。

custom レイヤーを最初にしたい理由は、このレイヤーがカスタム(しゃれなし)でスキンアセットのカスタマイズされたバージョンを保持するためです。 ZMIを介して portal_kss レイヤーからアセットをカスタマイズする場合、カスタマイズされたバージョンは custom レイヤーに配置されます。スキンルックアップルールはレイヤースタックを上から下に向かって検索するため、 custom レイヤーのカスタマイズされたバージョンが、下のレイヤーのオリジナルの前に見つかるようにする必要があります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top