issue an event when page body is rendered, e.g. for access history
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@4200 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
2c6c871988
commit
c7060245e1
1 changed files with 22 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -22,18 +22,32 @@ A generic view class.
|
|||
$Id$
|
||||
"""
|
||||
|
||||
from zope import component
|
||||
from zope.interface import Interface, implements
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.publisher.interfaces.browser import IBrowserSkinType
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||
from zope.interface import Interface, implements
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope import component
|
||||
from zope.event import notify
|
||||
from zope.publisher.interfaces.browser import IBrowserSkinType
|
||||
|
||||
|
||||
mainTemplate = ViewPageTemplateFile('main.pt')
|
||||
popupTemplate = ViewPageTemplateFile('liquid/popup.pt')
|
||||
|
||||
|
||||
class IBodyRenderedEvent(Interface):
|
||||
""" Is fired when the page body has been rendered. """
|
||||
|
||||
|
||||
class BodyRenderedEvent(object):
|
||||
|
||||
implements(IBodyRenderedEvent)
|
||||
|
||||
def __init__(self, context, request):
|
||||
self.context = context
|
||||
self.request = request
|
||||
|
||||
|
||||
class UnboundTemplateFile(ViewPageTemplateFile):
|
||||
|
||||
def __get__(self, instance, type):
|
||||
|
@ -119,7 +133,9 @@ class GenericView(object):
|
|||
def pageBody(self):
|
||||
bodyTemplate = component.getMultiAdapter((self.context, self.request),
|
||||
name='body.html').bodyTemplate
|
||||
return bodyTemplate(self)
|
||||
body = bodyTemplate(self)
|
||||
notify(BodyRenderedEvent(self.context, self.request))
|
||||
return body
|
||||
|
||||
def setSkin(self, skinName):
|
||||
skin = None
|
||||
|
|
Loading…
Add table
Reference in a new issue