changeset 34244:fe5202bef5ce

configitems: register the 'web.refreshinterval' config
author Boris Feld <boris.feld@octobus.net>
date Fri, 30 Jun 2017 03:45:50 +0200
parents d24816dfdcff
children 945c9816ec1d
files mercurial/configitems.py mercurial/hgweb/hgwebdir_mod.py
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Jun 30 03:45:49 2017 +0200
+++ b/mercurial/configitems.py	Fri Jun 30 03:45:50 2017 +0200
@@ -634,6 +634,9 @@
 coreconfigitem('web', 'prefix',
     default='',
 )
+coreconfigitem('web', 'refreshinterval',
+    default=20,
+)
 coreconfigitem('worker', 'backgroundclose',
     default=dynamicdefault,
 )
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 03:45:49 2017 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Jun 30 03:45:50 2017 +0200
@@ -29,6 +29,7 @@
 from .request import wsgirequest
 
 from .. import (
+    configitems,
     encoding,
     error,
     hg,
@@ -124,10 +125,11 @@
         self.refresh()
 
     def refresh(self):
-        refreshinterval = 20
         if self.ui:
-            refreshinterval = self.ui.configint('web', 'refreshinterval',
-                                                refreshinterval)
+            refreshinterval = self.ui.configint('web', 'refreshinterval')
+        else:
+            item = configitems.coreitems['web']['refreshinterval']
+            refreshinterval = item.default
 
         # refreshinterval <= 0 means to always refresh.
         if (refreshinterval > 0 and