2009-10-18 07:52:27 -05:00
|
|
|
## Python Script "do.py"
|
2009-06-29 07:06:01 -05:00
|
|
|
##bind context=context
|
2009-10-18 07:52:27 -05:00
|
|
|
##parameters=action
|
2009-06-29 07:06:01 -05:00
|
|
|
rq = context.REQUEST
|
|
|
|
|
2009-10-20 09:57:00 -05:00
|
|
|
# Get the object impacted by the action.
|
|
|
|
if rq.get('objectUid', None):
|
2011-09-20 12:21:48 -05:00
|
|
|
obj = context.portal_catalog(UID=rq['objectUid'])[0].getObject()
|
2009-10-20 09:57:00 -05:00
|
|
|
else:
|
|
|
|
obj = context.getParentNode() # An appy obj or in some cases the app folder.
|
|
|
|
if obj.portal_type == 'AppyFolder':
|
|
|
|
from Products.CMFCore.utils import getToolByName
|
|
|
|
portal = getToolByName(obj, 'portal_url').getPortalObject()
|
|
|
|
obj = portal.get('portal_%s' % obj.id.lower()) # The tool
|
2010-08-05 11:23:17 -05:00
|
|
|
return obj.getMethod('on'+action)()
|