本文整理汇总了Python中Products.CMFCore.ActionInformation.ActionInformation类的典型用法代码示例。如果您正苦于以下问题:Python ActionInformation类的具体用法?Python ActionInformation怎么用?Python ActionInformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActionInformation类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Condition
def test_Condition(self):
portal = self.portal
folder = self.folder
object = self.object
ai = ActionInformation(id='view'
, title='View'
, action=Expression(
text='view')
, condition=Expression(
text='member')
, category='global'
, visible=1)
ec = createExprContext(folder, portal, object)
self.failIf(ai.testCondition(ec))
示例2: test_editing
def test_editing(self):
ai = ActionInformation(id='view',
category='folder',
)
ai.edit(id='new_id', title='blah')
self.assertEqual(ai.getId(), 'new_id')
self.assertEqual(ai.Title(), 'blah')
self.assertEqual(ai.Description(), '')
self.assertEqual(ai.getCondition(), '')
self.assertEqual(ai.getActionExpression(), '')
self.assertEqual(ai.getVisibility(), 1)
self.assertEqual(ai.getCategory(), 'folder')
self.assertEqual(ai.getPermissions(), ())
示例3: test_basic_construction
def test_basic_construction(self):
ai = ActionInformation(id='view'
)
self.assertEqual(ai.getId(), 'view')
self.assertEqual(ai.Title(), 'view')
self.assertEqual(ai.Description(), '')
self.assertEqual(ai.getCondition(), '')
self.assertEqual(ai.getActionExpression(), '')
self.assertEqual(ai.getVisibility(), 1)
self.assertEqual(ai.getCategory(), 'object')
self.assertEqual(ai.getPermissions(), ())
示例4: _importOldAction
def _importOldAction(self, old_action):
"""Convert a CMF action to an ERP5 action
This is used to update an existing site or to import a BT.
"""
import erp5.portal_type
ActionInformation = getattr(erp5.portal_type, 'Action Information')
old_action = old_action.__getstate__()
action_type = old_action.pop('category', None)
action = ActionInformation(self.generateNewId())
for k, v in old_action.iteritems():
if k in ('action', 'condition', 'icon'):
if not v:
continue
v = v.__class__(v.text)
setattr(action, {'id': 'reference',
'priority': 'float_index',
'permissions': 'action_permission',
}.get(k, k), v)
action.uid = None
action = self[self._setObject(action.id, action, set_owner=0)]
if action_type:
action._setCategoryMembership('action_type', action_type)
return action
示例5: _importOldAction
def _importOldAction(self, old_action):
"""Convert a CMF action to an ERP5 action
This is used to update an existing site or to import a BT.
"""
import erp5.portal_type
ActionInformation = getattr(erp5.portal_type, "Action Information")
old_action = old_action.__getstate__()
action_type = old_action.pop("category", None)
action = ActionInformation(self.generateNewId())
for k, v in old_action.iteritems():
if k in ("action", "condition", "icon"):
if not v:
continue
v = v.__class__(v.text)
setattr(
action, {"id": "reference", "priority": "float_index", "permissions": "action_permission"}.get(k, k), v
)
action.uid = None
action = self[self._setObject(action.id, action, set_owner=0)]
if action_type:
action._setCategoryMembership("action_type", action_type)
return action
示例6: test_construction_with_Expressions
def test_construction_with_Expressions(self):
ai = ActionInformation(id='view'
, title='View'
, action=Expression(
text='view')
, condition=Expression(
text='member')
, category='global'
, visible=0)
self.assertEqual(ai.getId(), 'view')
self.assertEqual(ai.Title(), 'View')
self.assertEqual(ai.Description(), '')
self.assertEqual(ai.getCondition(), 'member')
self.assertEqual(ai.getActionExpression(), 'string:view')
self.assertEqual(ai.getVisibility(), 0)
self.assertEqual(ai.getCategory(), 'global')
self.assertEqual(ai.getPermissions(), ())
示例7: getAction
def getAction(self, ec):
res = ActionInformation.getAction(self, ec)
res['description'] = self.getDescription()
return res
示例8: __init__
def __init__(self, appId, **kwargs):
self.appId = appId
ActionInformation.__init__(self, **kwargs)