def add_field(self, name, script, lang=None, params=None, ignore_failure=False):
data = {}<EOL>if lang:<EOL><INDENT>data["<STR_LIT>"] = lang<EOL><DEDENT>if script:<EOL><INDENT>data['<STR_LIT>'] = script<EOL><DEDENT>else:<EOL><INDENT>raise ScriptFieldsError("<STR_LIT>")<EOL><DEDENT>if params:<EOL><INDENT>if isinstance(params, dict):<EOL><INDENT>if len(params):<EOL><INDENT>data['<STR_LIT>'] = params<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ScriptFieldsError("<STR_LIT>")<EOL><DEDENT><DEDENT>if ignore_failure:<EOL><INDENT>data['<STR_LIT>'] = ignore_failure<EOL><DEDENT>self.fields[name] = data<EOL>
Add a field to script_fields