from AccessControl.SecurityInfo import ClassSecurityInfo from Products.Five import BrowserView from zope.component import getUtility, queryUtility from Products.iva.interfaces import IStatistics, IUserManager, IMessenger from AccessControl import getSecurityManager import time from random import shuffle class PublicView(BrowserView): def randomImage(self): """ chooses 3/4 images to place on frontpage """ imgs = self.context.images.frontpage.objectValues() shuffle(imgs) count = 6 return imgs[:6] def getFrontPageMessages(self): ms = queryUtility(IMessenger, name="IVAMessenger") if ms is None: return msgs = ms.getFrontPageMessages() res = "" for m in msgs: res += "
%s
" % m return res