[cpif] r293 - trunk/frontend-web

svn at argo.es svn at argo.es
Fri Jul 27 01:16:11 CEST 2007


Author: jcea
Date: Fri Jul 27 01:16:09 2007
New Revision: 293

Log:
Pulimos un par de cosas del cacheado de objetos estaticos

Modified:
   trunk/frontend-web/url_static.py

Modified: trunk/frontend-web/url_static.py
==============================================================================
--- trunk/frontend-web/url_static.py	(original)
+++ trunk/frontend-web/url_static.py	Fri Jul 27 01:16:09 2007
@@ -5,20 +5,25 @@
 @monitor
 def gestiona_url(conn,handler,path,usuario) :
   if len(path)!=3 : return None
-  section,etag=path[1],path[2]
+  section,hash=path[1],path[2]
+  etag='"%s"' %hash
   headers={"ETag":etag,"Cache-Control":"max-age=31536000"}
 
   import database
-  data=database.get_static(conn,section,etag)
+  data=database.get_static(conn,section,hash)
   if not data : return None # Not found
 
   metadata,data=data
   data=data[0] # de-encapsulate
   headers["Last-Modified"]=metadata["last modified"]
 
-  if handler.headers.get("if-none-match")==etag :
-    return (304,headers,"")
+  if_none_match=handler.headers.get("if-none-match")
+  if if_none_match :
+    for i in if_none_match.split(",") :
+      if etag==i.strip() :
+        return (304,headers,"")
 
+  headers["ETag"]=etag
   headers["Content-Type"]=metadata["content-type"]
 
   return (200,headers,data)



More information about the cpif mailing list