MCPcopy Create free account
hub / github.com/StackStorm/st2 / _get_model_instance

Method _get_model_instance

st2common/st2common/router.py:754–768  ·  view source on GitHub ↗
(self, model_cls, data)

Source from the content-addressed store, hash-verified

752 return resp(environ, start_response)
753
754 def _get_model_instance(self, model_cls, data):
755 try:
756 instance = model_cls(**data)
757 except TypeError as e:
758 # Throw a more user-friendly exception when input data is not an object
759 if "type object argument after ** must be a mapping, not" in six.text_type(
760 e
761 ):
762 type_string = get_json_type_for_python_value(data)
763 msg = "Input body needs to be an object, got: %s" % (type_string)
764 raise ValueError(msg)
765
766 raise e
767
768 return instance
769
770 def _process_response(
771 self,

Callers 1

__call__Method · 0.95

Calls 1

Tested by

no test coverage detected