Commit dc608eba authored by Yusei Tahara's avatar Yusei Tahara

Added a monkey patch for pythonscript. if pythonscript has proxyrole, the icon...

Added a monkey patch for pythonscript. if pythonscript has proxyrole, the icon will turns from green to red.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16644 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d178508
......@@ -53,6 +53,7 @@ from Products.ERP5Type.patches import copy_reg_patch
from Products.ERP5Type.patches import PersistencePatch
from Products.ERP5Type.patches import PersistentMapping
from Products.ERP5Type.patches import DateTimePatch
from Products.ERP5Type.patches import PythonScript
# for python2.3 compatibility
import threading
......
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from Products.PythonScripts.PythonScript import PythonScript
from OFS.misc_ import p_
from App.ImageFile import ImageFile
def haveProxyRole(self):
"""if a script has proxy role, return True"""
if self._proxy_roles:
return True
return False
def om_icons(self):
"""Return a list of icon URLs to be displayed by an ObjectManager"""
icons = ({'path': 'misc_/PythonScripts/pyscript.gif',
'alt': self.meta_type, 'title': self.meta_type},)
if self.haveProxyRole():
icons = ({'path': 'p_/PythonScript_ProxyRole_icon',
'alt': 'Proxy Roled Python Script',
'title': 'This script has proxy role.'},)
return icons
pyscript_proxyrole = ImageFile('pyscript_proxyrole.gif', globals())
#
# Add proxy role icon in ZMI
#
PythonScript.haveProxyRole = haveProxyRole
PythonScript.om_icons = om_icons
p_.PythonScript_ProxyRole_icon = pyscript_proxyrole
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