# -*- coding: utf-8 # Copyright 2007 by Vahur Rebas from AccessControl import ClassSecurityInfo from Globals import InitializeClass from AccessControl import getSecurityManager from OFS.SimpleItem import SimpleItem from OFS.PropertyManager import PropertyManager from Products.CMFCore.utils import UniqueObject from Products.CMFCore.utils import getToolByName class CachingTool(PropertyManager, UniqueObject, SimpleItem): id = 'caching_tool' meta_type = 'CachingTool' security = ClassSecurityInfo() toolicon = 'skins/plone_images/event_icon.gif' plone_tool = 1 def _getGroups(self): if hasattr(self, '_v_groupcache'): return self._v_groupcache gt = getToolByName(self, 'portal_groups') grlist = gt.listGroups() return grlist def _getGroupMembers(self, group): #if hasattr(self, '_v_grcache'): # if self._v_grcache.has_key(str(group)): # return self._v_grcache[str(group)] #else: # self._v_grcache = {} if hasattr(group, 'getGroupMembers'): memberslist = group.getGroupMembers() #self._v_grcache[str(group)] = memberslist return memberslist return [] InitializeClass(CachingTool)