Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 304:d8361dd70d2d
FIX: Map unicode strings to boolean values because this is the canonical texttype in confixmmix
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 25 Apr 2021 18:05:26 +0200 |
| parents | 063099b188cd |
| children | f529ca46dd50 |
comparison
equal
deleted
inserted
replaced
| 303:2a2f5b86fe34 | 304:d8361dd70d2d |
|---|---|
| 120 return self._BOOL_CVT[sl] | 120 return self._BOOL_CVT[sl] |
| 121 else: | 121 else: |
| 122 return s | 122 return s |
| 123 | 123 |
| 124 # Conversion of booleans | 124 # Conversion of booleans |
| 125 _BOOL_CVT = {'1': True, 'yes': True, 'true': True, 'on': True, | 125 _BOOL_CVT = { |
| 126 '0': False, 'no': False, 'false': False, 'off': False} | 126 u('1'): True, u('yes'): True, u('true'): True, u('on'): True, |
| 127 u('0'): False, u('no'): False, u('false'): False, u('off'): False | |
| 128 } | |
| 127 | 129 |
| 128 def getfloatvar_s(self, varname, default=_MARKER): | 130 def getfloatvar_s(self, varname, default=_MARKER): |
| 129 """Get a (possibly substituted) variable and convert text to a | 131 """Get a (possibly substituted) variable and convert text to a |
| 130 float | 132 float |
| 131 | 133 |
