Commit aacc7bc1 authored by Boris Kocherov's avatar Boris Kocherov

BusinessTemplate: fix problem of not installment bt's actions whose

containers are not IActionProvider.
This problem arised as result of my convert portal_action to erp5's action tool.
parent 40218cda
......@@ -83,6 +83,7 @@ from warnings import warn
from lxml.etree import parse
from xml.sax.saxutils import escape
from Products.CMFCore.Expression import Expression
from Products.CMFCore.interfaces import IActionProvider
from urllib import quote, unquote
from difflib import unified_diff
import posixpath
......@@ -3186,7 +3187,6 @@ class ActionTemplateItem(ObjectTemplateItem):
return obj._exportOldAction(action)
def _getPortalToolActionCopy(self, obj, context, value):
from Products.CMFCore.interfaces import IActionProvider
if not IActionProvider.providedBy(obj):
# look for the action in portal_actions, instead of the original object
LOG('Products.ERP5.Document.BusinessTemplate', WARNING,
......@@ -3253,15 +3253,9 @@ class ActionTemplateItem(ObjectTemplateItem):
container = p.unrestrictedTraverse(path)
if interfaces.ITypeProvider.providedBy(aq_parent(aq_inner(container)))\
or IActionsTool.providedBy(container):
# XXX future BT should use 'reference' instead of 'id'
reference = getattr(obj, 'reference', None) or obj.id
portal_type_dict.setdefault(path, {})[reference] = obj
continue
or IActionsTool.providedBy(container)\
or not IActionProvider.providedBy(container):
# Following code is for actions outside Types Tool.
# It will be removed when they are also converted to ERP5 actions.
from Products.CMFCore.interfaces import IActionProvider
if not IActionProvider.providedBy(container):
# some tools stopped being ActionProviders in CMF 2.x. Drop the
# action into portal_actions.
......@@ -3270,7 +3264,15 @@ class ActionTemplateItem(ObjectTemplateItem):
'Attempted to store action %r in %r which is no longer an '
'IActionProvider. Storing action on portal_actions instead' %
(id, path))
container = p.portal_actions
path = 'portal_actions'
# XXX future BT should use 'reference' instead of 'id'
reference = getattr(obj, 'reference', None) or obj.id
portal_type_dict.setdefault(path, {})[reference] = obj
continue
# Following code is for actions outside Types Tool.
# It will be removed when they are also converted to ERP5 actions.
obj, action = container, obj
action_list = obj.listActions()
for index in range(len(action_list)):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment