[Zope3-checkins] CVS: Zope3/src/zope/app/services - session.py:1.6

Steve Alexander steve@cat-box.net
Fri, 28 Feb 2003 09:19:40 -0500


Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv31499/src/zope/app/services

Modified Files:
	session.py 
Log Message:
Made the sessions service use the application URL from the request as the
path of the cookies it sets.


=== Zope3/src/zope/app/services/session.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/session.py:1.5	Thu Feb 27 03:11:31 2003
+++ Zope3/src/zope/app/services/session.py	Fri Feb 28 09:19:39 2003
@@ -82,10 +82,19 @@
 
     def setRequestId(self, request, id):
         """Set cookie with id on request."""
+        # XXX Currently, the path is the ApplicationURL. This is reasonable,
+        #     and will be adequate for most purposes.
+        #     A better path to use would be that of the folder that contains
+        #     the service-manager this service is registered within. However,
+        #     that would be expensive to look up on each request, and would
+        #     have to be altered to take virtual hosting into account.
+        #     Seeing as this service instance has a unique namespace for its
+        #     cookie, using ApplicationURL shouldn't be a problem.
         request.response.setCookie(
                 self.namespace,
                 id,
-                expires=build_http_date(time.time() + 1800)
+                expires=build_http_date(time.time() + 1800),
+                path=request.getApplicationURL(path_only=True)
                 )