[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/app/session/ Make
registration of adapters easier from Python code by usiing an
adapts()
Philipp von Weitershausen
philikon at philikon.de
Thu Aug 31 16:54:53 EDT 2006
Log message for revision 69905:
Make registration of adapters easier from Python code by usiing an adapts()
declaration. Remove redundant info from ZCML subsequently.
Changed:
U Zope3/branches/3.3/src/zope/app/session/configure.zcml
U Zope3/branches/3.3/src/zope/app/session/session.py
-=-
Modified: Zope3/branches/3.3/src/zope/app/session/configure.zcml
===================================================================
--- Zope3/branches/3.3/src/zope/app/session/configure.zcml 2006-08-31 20:54:16 UTC (rev 69904)
+++ Zope3/branches/3.3/src/zope/app/session/configure.zcml 2006-08-31 20:54:52 UTC (rev 69905)
@@ -5,23 +5,18 @@
>
<adapter
- for="zope.publisher.interfaces.IRequest"
- provides=".interfaces.IClientId"
factory=".session.ClientId"
permission="zope.Public"
/>
<adapter
- for="zope.publisher.interfaces.IRequest"
- provides=".interfaces.ISession"
factory=".session.Session"
permission="zope.Public"
/>
<adapter
- for="zope.publisher.interfaces.IRequest"
- provides="zope.traversing.interfaces.IPathAdapter"
factory=".session.Session"
+ provides="zope.traversing.interfaces.IPathAdapter"
name="session"
/>
Modified: Zope3/branches/3.3/src/zope/app/session/session.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/session/session.py 2006-08-31 20:54:16 UTC (rev 69904)
+++ Zope3/branches/3.3/src/zope/app/session/session.py 2006-08-31 20:54:52 UTC (rev 69905)
@@ -27,8 +27,9 @@
from zope import schema
from zope.interface import implements
-from zope.component import getUtility
+from zope.component import getUtility, adapts
from zope.component.interfaces import ComponentLookupError
+from zope.publisher.interfaces import IRequest
from zope.annotation.interfaces import IAttributeAnnotatable
from interfaces import \
@@ -61,6 +62,7 @@
"""
implements(IClientId)
+ adapts(IRequest)
def __new__(cls, request):
return str.__new__(
@@ -262,6 +264,8 @@
class Session(object):
"""See zope.app.session.interfaces.ISession"""
implements(ISession)
+ adapts(IRequest)
+
def __init__(self, request):
self.client_id = str(IClientId(request))
More information about the Zope3-Checkins
mailing list