Commit e98295a782db73ebbff9b43f50b655cd1aa658ac

Authored by Carlos Vieira
1 parent 7a137184
Exists in master

barrabrasil.py: cache publico e retirado o etag.

Showing 1 changed file with 10 additions and 10 deletions   Show diff stats
app/barrabrasil.py
@@ -40,15 +40,15 @@ def barra(): @@ -40,15 +40,15 @@ def barra():
40 profile = cfg.profile 40 profile = cfg.profile
41 with app.open_resource('templates/%s/barra-brasil.js' % profile) as f: 41 with app.open_resource('templates/%s/barra-brasil.js' % profile) as f:
42 conteudo = f.read().decode('utf-8') 42 conteudo = f.read().decode('utf-8')
43 - etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest()  
44 - if request.if_none_match and \  
45 - etag in request.if_none_match:  
46 - resposta = Response(status=304)  
47 - else: # nao esta em cache do navegador  
48 - resposta = make_response(conteudo)  
49 - resposta.set_etag(etag)  
50 - resposta.headers['Content-type'] = 'application/javascript'  
51 - resposta.headers['Cache-control'] = 'max-age: 86400' #24 horas 43 + #etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest()
  44 + #if request.if_none_match and \
  45 + # etag in request.if_none_match:
  46 + # resposta = Response(status=304)
  47 + #else: # nao esta em cache do navegador
  48 + resposta = make_response(conteudo)
  49 + # resposta.set_etag(etag)
  50 + resposta.headers['Content-type'] = 'application/x-javascript'
  51 + resposta.headers['Cache-control'] = 'public, max-age: 86400' #24 horas
52 resposta.headers['Last-Modified'] = 'Mon, 30 Sep 2013 19:08:30 GMT' 52 resposta.headers['Last-Modified'] = 'Mon, 30 Sep 2013 19:08:30 GMT'
53 return resposta 53 return resposta
54 54
@@ -58,7 +58,7 @@ def fonte(): @@ -58,7 +58,7 @@ def fonte():
58 conteudo = f.read().decode('base64') 58 conteudo = f.read().decode('base64')
59 resposta = make_response(conteudo) 59 resposta = make_response(conteudo)
60 resposta.headers['Content-type'] = 'application/x-font-woff' 60 resposta.headers['Content-type'] = 'application/x-font-woff'
61 - resposta.headers['Cache-control'] = 'max-age: 86400' #24 horas 61 + resposta.headers['Cache-control'] = 'public, max-age: 86400' #24 horas
62 resposta.headers['Last-Modified'] = 'Mon, 30 Sep 2013 19:08:30 GMT' 62 resposta.headers['Last-Modified'] = 'Mon, 30 Sep 2013 19:08:30 GMT'
63 return resposta 63 return resposta
64 64