Zope 2 integration for zope.globalrequest
Python
Switch branches/tags
Nothing to show
Latest commit dc66a99 Sep 30, 2016 @icemac icemac committed on GitHub Note down Python 3 support.

README.rst

Overview

This package integrates zope.globalrequest with Zope. It is compatible with Zope 2.12 and later.

The only thing you need to do to use this package is to load its configuration from your own ZCML file:

<include package="five.globalrequest" />

You can now use zope.globalrequest as normal:

from zope.globalrequest import getRequest
request = getRequest()

The request is set up when publication starts, when the IPubStart event is fired. It is cleared on one of the IPubEnd events: IPubSuccess or IPubFailure. If you have your own event handlers for either of these events, you should be aware that the event setup/clear could happen after/ before your own event handler is executed, since the order of execution for event handlers is not controllable.