Skip to content

Commit

Permalink
declare the interface first
Browse files Browse the repository at this point in the history
  • Loading branch information
witsch committed Jan 15, 2009
1 parent 1ee860e commit c9c6993
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/zope/globalrequest/README.txt
Expand Up @@ -7,7 +7,9 @@ Introduction
This package provides a global way to retrieve the currently active request
object in a zope-based web framework.

Let's see if the test setup works:
Let's just check the interfaces for now:

>>> from zope import globalrequest
>>> from zope.globalrequest.interfaces import IGlobalRequest
>>> IGlobalRequest
<InterfaceClass zope.globalrequest.interfaces.IGlobalRequest>

6 changes: 5 additions & 1 deletion src/zope/globalrequest/__init__.py
@@ -1 +1,5 @@
# the existance of __init__.py make this a module...
from zope.interface.declarations import moduleProvides
from zope.globalrequest.interfaces import IGlobalRequest

moduleProvides(IGlobalRequest)

16 changes: 16 additions & 0 deletions src/zope/globalrequest/interfaces.py
@@ -0,0 +1,16 @@
from zope.interface import Interface


class IGlobalRequest(Interface):
""" interface to handle retrieval and setting of the currently
used request object in a thread-local manner """

def getRequest():
""" return the currently active request object """

def setRequest(request):
""" set the request object to be returned by `getRequest` """

def clearRequest():
""" clear the stored request object """

0 comments on commit c9c6993

Please sign in to comment.