from zope.publisher.browser import BrowserView from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.security.interfaces import IUnauthenticatedPrincipal from zope.app.component.hooks import getSite from zope.traversing.browser import absoluteURL # Helper view, registered for IKrihvelBase that should be used by all Content classes in Krihvel class KrihvelHelper(BrowserView): # Test method for use on page templates # XXX need to find a more sane way for calling it ont on page templates that: # class python:views.__getitem__('base_view').test('Girl' in ['Boy'],'girlText','boyText') def test(self, cond, yes, no): if cond: return yes return no def getPortalURL(self): site = getSite() return absoluteURL(site, self.request)