##// END OF EJS Templates
config: use the new '_unset' value for 'configbytes'...
marmoute -
r32962:0bf986cf default
parent child Browse files
Show More
@@ -596,7 +596,7 b' class ui(object):'
596 return self.configwith(int, section, name, default, 'integer',
596 return self.configwith(int, section, name, default, 'integer',
597 untrusted)
597 untrusted)
598
598
599 def configbytes(self, section, name, default=0, untrusted=False):
599 def configbytes(self, section, name, default=_unset, untrusted=False):
600 """parse a configuration element as a quantity in bytes
600 """parse a configuration element as a quantity in bytes
601
601
602 Units can be specified as b (bytes), k or kb (kilobytes), m or
602 Units can be specified as b (bytes), k or kb (kilobytes), m or
@@ -618,11 +618,13 b' class ui(object):'
618 ConfigError: foo.invalid is not a byte quantity ('somevalue')
618 ConfigError: foo.invalid is not a byte quantity ('somevalue')
619 """
619 """
620
620
621 value = self.config(section, name, None, untrusted)
621 value = self.config(section, name, default, untrusted)
622 if value is None:
622 if value is None:
623 if not isinstance(default, str):
623 if default is _unset:
624 return default
624 default = 0
625 value = default
625 value = default
626 if not isinstance(value, str):
627 return value
626 try:
628 try:
627 return util.sizetoint(value)
629 return util.sizetoint(value)
628 except error.ParseError:
630 except error.ParseError:
General Comments 0
You need to be logged in to leave comments. Login now