[Checkins] SVN: zope.globalrequest/trunk/src/zope/globalrequest/ declare the interface first
Andreas Zeidler
az at zitc.de
Thu Jan 15 09:43:34 EST 2009
Log message for revision 94747:
declare the interface first
Changed:
U zope.globalrequest/trunk/src/zope/globalrequest/README.txt
U zope.globalrequest/trunk/src/zope/globalrequest/__init__.py
A zope.globalrequest/trunk/src/zope/globalrequest/interfaces.py
-=-
Modified: zope.globalrequest/trunk/src/zope/globalrequest/README.txt
===================================================================
--- zope.globalrequest/trunk/src/zope/globalrequest/README.txt 2009-01-15 14:43:26 UTC (rev 94746)
+++ zope.globalrequest/trunk/src/zope/globalrequest/README.txt 2009-01-15 14:43:33 UTC (rev 94747)
@@ -7,7 +7,9 @@
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>
Modified: zope.globalrequest/trunk/src/zope/globalrequest/__init__.py
===================================================================
--- zope.globalrequest/trunk/src/zope/globalrequest/__init__.py 2009-01-15 14:43:26 UTC (rev 94746)
+++ zope.globalrequest/trunk/src/zope/globalrequest/__init__.py 2009-01-15 14:43:33 UTC (rev 94747)
@@ -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)
+
Added: zope.globalrequest/trunk/src/zope/globalrequest/interfaces.py
===================================================================
--- zope.globalrequest/trunk/src/zope/globalrequest/interfaces.py (rev 0)
+++ zope.globalrequest/trunk/src/zope/globalrequest/interfaces.py 2009-01-15 14:43:33 UTC (rev 94747)
@@ -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 """
+
More information about the Checkins
mailing list