Fix default variable values having substitutions from the calculus
This commit is contained in:
parent
251a0ff314
commit
e99559f6ad
1 changed files with 5 additions and 3 deletions
|
|
@ -525,7 +525,6 @@ def _Substitute( template, mapping ):
|
||||||
if mo.group( 'braceddefault' ) is not None:
|
if mo.group( 'braceddefault' ) is not None:
|
||||||
named = mo.group( 'defname' )
|
named = mo.group( 'defname' )
|
||||||
if named not in mapping:
|
if named not in mapping:
|
||||||
''
|
|
||||||
raise MissingSubstitution(
|
raise MissingSubstitution(
|
||||||
named,
|
named,
|
||||||
mo.group( 'default' ).replace( '\\}', '}' ) )
|
mo.group( 'default' ).replace( '\\}', '}' ) )
|
||||||
|
|
@ -567,8 +566,11 @@ def ExpandReferencesInString( orig_s,
|
||||||
if default_value is None and e.default_value is not None:
|
if default_value is None and e.default_value is not None:
|
||||||
try:
|
try:
|
||||||
default_value = _Substitute( e.default_value, mapping )
|
default_value = _Substitute( e.default_value, mapping )
|
||||||
except MissingSubstitution:
|
except MissingSubstitution as e2:
|
||||||
default_value = e.default_value
|
if e2.name in calculus:
|
||||||
|
default_value = calculus[ e2.name ]()
|
||||||
|
else:
|
||||||
|
default_value = e.default_value
|
||||||
|
|
||||||
mapping[ key ] = AskForInput( 'Enter value for {}: '.format( key ),
|
mapping[ key ] = AskForInput( 'Enter value for {}: '.format( key ),
|
||||||
default_value )
|
default_value )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue