REMOTE_USER on session, expires on 304

dbinger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Fri, 08 Apr 2005 08:41:54 -0400
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------050401050909050104060002
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit



--------------050401050909050104060002
Content-Type: message/rfc822;
 name="SVN: r26523 - trunk/quixote"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="SVN: r26523 - trunk/quixote"

Return-Path: <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
Delivered-To: [email protected]
Received: (qmail 3560 invoked from network); 8 Apr 2005 10:20:20 -0000
Received: from monk.mems-exchange.org (132.151.8.3)
	by 0 with SMTP; 8 Apr 2005 10:20:20 -0000
Received: (qmail 26956 invoked by alias); 8 Apr 2005 10:20:20 -0000
Delivered-To: mems-exchange.org-dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Received: (qmail 26953 invoked by alias); 8 Apr 2005 10:20:20 -0000
Delivered-To: mems-exchange.org-mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Received: (qmail 26951 invoked from network); 8 Apr 2005 10:20:19 -0000
Received: from miles.mems-exchange.org (132.151.8.12)
	by 132.151.8.3 with SMTP; 08 Apr 2005 06:20:19 -0400
Received: from dbinger by miles.mems-exchange.org with local (Exim 3.36 #1)
	id 1DJqb5-0007qE-00
	for mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]; Fri, 08 Apr 2005 06:20:19 -0400
To: mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Subject: SVN: r26523 - trunk/quixote
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
Message-Id: <E1DJqb5-0007qE-00-diuEHtAPqkYJ2/[email protected]>
Date: Fri, 08 Apr 2005 06:20:19 -0400

Author: dbinger
Date: 2005-04-08 06:20:19 -0400 (Fri, 08 Apr 2005)
New Revision: 26523

Modified:
   trunk/quixote/util.py
Log:
nas: Have StaticFile set the Expires header for a "304 Not Modified"
response just like it would for a normal response. 

Changed:
quixote/util.py


Modified: trunk/quixote/util.py
===================================================================
--- trunk/quixote/util.py	2005-04-08 01:14:07 UTC (rev 26522)
+++ trunk/quixote/util.py	2005-04-08 10:20:19 UTC (rev 26523)
@@ -172,10 +172,20 @@
         if not self.follow_symlinks and os.path.islink(self.path):
             raise errors.TraversalError(private_msg="Path %r is a symlink"
                                         % self.path)
+        request = quixote.get_request()
+        response = quixote.get_response()
+
+        if self.cache_time is None:
+            response.set_expires(None) # don't set the Expires header
+        else:
+            # explicitly allow client to cache page by setting the Expires
+            # header, this is even more efficient than the using
+            # Last-Modified/If-Modified-Since since the browser does not need
+            # to contact the server
+            response.set_expires(seconds=self.cache_time)
+
         stat = os.stat(self.path)
         last_modified = formatdate(stat.st_mtime)
-        request = quixote.get_request()
-        response = quixote.get_response()
         if last_modified == request.get_header('If-Modified-Since'):
             # handle exact match of If-Modified-Since header
             response.set_status(304)
@@ -188,15 +198,6 @@
 
         response.set_header('Last-Modified', last_modified)
 
-        if self.cache_time is None:
-            response.set_expires(None) # don't set the Expires header
-        else:
-            # explicitly allow client to cache page by setting the Expires
-            # header, this is even more efficient than the using
-            # Last-Modified/If-Modified-Since since the browser does not need
-            # to contact the server
-            response.set_expires(seconds=self.cache_time)
-
         return FileStream(open(self.path, 'rb'), stat.st_size)
 
 


--------------050401050909050104060002
Content-Type: message/rfc822;
 name="SVN: r26524 - trunk/quixote"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="SVN: r26524 - trunk/quixote"

Return-Path: <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
Delivered-To: [email protected]
Received: (qmail 3588 invoked from network); 8 Apr 2005 10:22:35 -0000
Received: from monk.mems-exchange.org (132.151.8.3)
	by 0 with SMTP; 8 Apr 2005 10:22:35 -0000
Received: (qmail 26978 invoked by alias); 8 Apr 2005 10:22:35 -0000
Delivered-To: mems-exchange.org-dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Received: (qmail 26975 invoked by alias); 8 Apr 2005 10:22:35 -0000
Delivered-To: mems-exchange.org-mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Received: (qmail 26973 invoked from network); 8 Apr 2005 10:22:35 -0000
Received: from miles.mems-exchange.org (132.151.8.12)
	by 132.151.8.3 with SMTP; 08 Apr 2005 06:22:35 -0400
Received: from dbinger by miles.mems-exchange.org with local (Exim 3.36 #1)
	id 1DJqdG-0007qZ-00
	for mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]; Fri, 08 Apr 2005 06:22:34 -0400
To: mems-cvs-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]
Subject: SVN: r26524 - trunk/quixote
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
Message-Id: <E1DJqdG-0007qZ-00-diuEHtAPqkYJ2/[email protected]>
Date: Fri, 08 Apr 2005 06:22:34 -0400

Author: dbinger
Date: 2005-04-08 06:22:34 -0400 (Fri, 08 Apr 2005)
New Revision: 26524

Modified:
   trunk/quixote/session.py
Log:
nas: insert REMOTE_USER environment value.

Changed:
quixote/session.py


Modified: trunk/quixote/session.py
===================================================================
--- trunk/quixote/session.py	2005-04-08 10:20:19 UTC (rev 26523)
+++ trunk/quixote/session.py	2005-04-08 10:22:34 UTC (rev 26524)
@@ -487,6 +487,8 @@
         object has been built, but before we traverse the URL or call the
         callable object found by URL traversal.
         """
+        if self.user is not None:
+            get_request().environ['REMOTE_USER'] = str(self.user)
 
     # -- Simple accessors and modifiers --------------------------------
 


--------------050401050909050104060002--