appypod-rattail/gen/plone25/skin/do.py

16 lines
588 B
Python
Raw Normal View History

## Python Script "do.py"
2009-06-29 07:06:01 -05:00
##bind context=context
##parameters=action
2009-06-29 07:06:01 -05:00
rq = context.REQUEST
# Get the object impacted by the action.
if rq.get('objectUid', None):
2009-06-29 07:06:01 -05:00
obj = context.uid_catalog(UID=rq['objectUid'])[0].getObject()
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
return obj.getAppyAttribute('on'+action)()