def set_errors(self, result):
<EOL>errors = result.get_messages()<EOL>for property_name in errors:<EOL><INDENT>if not hasattr(self, property_name):<EOL><INDENT>continue <EOL><DEDENT>prop_errors = errors[property_name]<EOL>if type(prop_errors) is not list:<EOL><INDENT>prop_errors = ['<STR_LIT>']<EOL><DEDENT>if property_name in self.errors:<EOL><INDENT>self.errors[property_name].extend(prop_errors)<EOL><DEDENT>else:<EOL><INDENT>self.errors[property_name] = prop_errors<EOL><DEDENT><DEDENT>
Populate field errors with errors from schema validation