Patchwork [19,of,23] configitems: register the 'web.refreshinterval' config

login
register
mail settings
Submitter Boris Feld
Date Sept. 16, 2017, 6:28 p.m.
Message ID <dfa73a56a4006e91480b.1505586506@FB>
Download mbox | patch
Permalink /patch/23971/
State Accepted
Headers show

Comments

Boris Feld - Sept. 16, 2017, 6:28 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498787150 -7200
#      ven. juin 30 03:45:50 2017 +0200
# Node ID dfa73a56a4006e91480b77ca0fbda8ba1e7a454d
# Parent  4372d845a3441e704ff461c6fde407f5eff55ab2
# EXP-Topic config.register.web
configitems: register the 'web.refreshinterval' config

Patch

diff -r 4372d845a344 -r dfa73a56a400 mercurial/configitems.py
--- a/mercurial/configitems.py	ven. juin 30 03:45:49 2017 +0200
+++ b/mercurial/configitems.py	ven. juin 30 03:45:50 2017 +0200
@@ -634,6 +634,9 @@ 
 coreconfigitem('web', 'prefix',
     default='',
 )
+coreconfigitem('web', 'refreshinterval',
+    default=20,
+)
 coreconfigitem('worker', 'backgroundclose',
     default=dynamicdefault,
 )
diff -r 4372d845a344 -r dfa73a56a400 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	ven. juin 30 03:45:49 2017 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	ven. juin 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