def set(self, handler, attr, name, path, cfg):
full_name = ("<STR_LIT>" % (path, name)).strip("<STR_LIT:.>")<EOL>if attr.default is None:<EOL><INDENT>default = None<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>comp = vodka.component.Component(cfg)<EOL>default = handler.default(name, inst=comp)<EOL>if self.skip_defaults:<EOL><INDENT>self.echo("<STR_LIT>" % (full_name, default))<EOL>return default<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>self.echo("<STR_LIT>")<EOL>self.echo(attr.help_text)<EOL>if attr.choices:<EOL><INDENT>self.echo("<STR_LIT>" % "<STR_LIT:U+002CU+0020>".join([str(c) for c in attr.choices]))<EOL><DEDENT>b = False<EOL>while not b:<EOL><INDENT>try:<EOL><INDENT>if type(attr.expected_type) == type:<EOL><INDENT>r = self.prompt(full_name, default=default, type=attr.expected_type)<EOL>r = attr.expected_type(r)<EOL><DEDENT>else:<EOL><INDENT>r = self.prompt(full_name, default=default, type=str)<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>self.echo("<STR_LIT>"% attr.expected_type)<EOL><DEDENT>try:<EOL><INDENT>b = handler.check({name:r}, name, path)<EOL><DEDENT>except Exception as inst:<EOL><INDENT>if hasattr(inst, "<STR_LIT>"):<EOL><INDENT>self.echo(inst.explanation)<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>return r<EOL>
Obtain value for config variable, by prompting the user
for input and substituting a default value if needed.

Also does validation on user input