[PATCH 2 of 2 v2] hgweb: forward arguments to ui.config
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sat Jul 1 11:13:22 EDT 2017
On 07/01/2017 06:03 AM, demelier.david at gmail.com wrote:
> On Thu, 2017-06-29 at 21:42 -0700, Jun Wu wrote:
>> I might miss something, but why is this change necessary? I slightly
>> prefer
>> the old code where arguments are more explicit, and people can
>> override
>> untrusted to False.
>
> The problem is that def.config uses a local _unset variable for the
> default argument.
>
> The hgweb_mod.py uses None so you get a warning while running the tests
> because of this code:
>
> 463 msg = ("specifying a default value for a registered "
> 464 "config item: '%s.%s' '%s'")
>
> An other solution woudl be to rename _unset to unset and export it so
> that hgweb_mod.py can pass unset instead of None by default.
>
> What do you think?
The issue with your patch is that is change the behavior from
* untrusted default to False but another value can be passed
to
* untrusted is always True.
You can easily fixes it by avoiding overwriting the untrusted value if
it is passed.
The extended version of the code would be:
if 'untrusted' not in kwargs:
kwargs['untrusted'] = True
A short version would be:
kwargs.setdefault('untrusted', True)
Cheers,
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list