Added auto-reload of /sources page every 5 minutes
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 20 Nov 2010 10:58:03 +0000 (10:58 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 20 Nov 2010 10:58:03 +0000 (10:58 +0000)
bin/djais/views.py

index f26c14495d823bd953620b74ca136fe7878489d6..f18fe0bb1e4db22b9ae18c36742a2af47a772da8 100644 (file)
@@ -960,20 +960,22 @@ class StatsSelectorForm(forms.Form):
 
 @http_authenticate(auth, 'ais')
 def sources_index(request):
-    active_minutes = 5
+    ACTIVE_MINUTES = 5
     peers_config = peers_get_config()
     peers_display = []
     for id4, peer in peers_config.iteritems():
         peer['id4'] = id4
         peer['id2'] = id4[2:]
-        peer['active'] = is_id4_active(id4, 60*active_minutes)
+        peer['active'] = is_id4_active(id4, 60*ACTIVE_MINUTES)
         peers_display.append(peer)
         
     peers_display = sorted(peers_display, key=lambda k: k['id4'])
 
     form = StatsSelectorForm()
 
-    return render_to_response('sources_index.html', {'sources':peers_display, 'active_minutes': active_minutes, 'form': form}, RequestContext(request))
+    response = render_to_response('sources_index.html', {'sources':peers_display, 'active_minutes': ACTIVE_MINUTES, 'form': form}, RequestContext(request))
+    response['Refresh'] = 60*ACTIVE_MINUTES
+    return response
 
 
 @http_authenticate(auth, 'ais')