comparison hgext/zeroconf/__init__.py @ 33178:a0068f49b5f6

zeroconf: blindly forward extra argument to the core config method The new default value handling is simpler if we let the original function handle everything.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 01 Jul 2017 21:57:17 +0200
parents 564a96a56b73
children a6c18628dff1
comparison
equal deleted inserted replaced
33177:be723e2afd3d 33178:a0068f49b5f6
165 name = value.name[:value.name.index('.')] 165 name = value.name[:value.name.index('.')]
166 url = "http://%s:%s%s" % (socket.inet_ntoa(value.address), value.port, 166 url = "http://%s:%s%s" % (socket.inet_ntoa(value.address), value.port,
167 value.properties.get("path", "/")) 167 value.properties.get("path", "/"))
168 yield "zc-" + name, url 168 yield "zc-" + name, url
169 169
170 def config(orig, self, section, key, default=None, untrusted=False): 170 def config(orig, self, section, key, *args, **kwargs):
171 if section == "paths" and key.startswith("zc-"): 171 if section == "paths" and key.startswith("zc-"):
172 for name, path in getzcpaths(): 172 for name, path in getzcpaths():
173 if name == key: 173 if name == key:
174 return path 174 return path
175 return orig(self, section, key, default, untrusted) 175 return orig(self, section, key, *args, **kwargs)
176 176
177 def configitems(orig, self, section, *args, **kwargs): 177 def configitems(orig, self, section, *args, **kwargs):
178 repos = orig(self, section, *args, **kwargs) 178 repos = orig(self, section, *args, **kwargs)
179 if section == "paths": 179 if section == "paths":
180 repos += getzcpaths() 180 repos += getzcpaths()