本文整理汇总了Python中pyon.public.IonObject._validate方法的典型用法代码示例。如果您正苦于以下问题:Python IonObject._validate方法的具体用法?Python IonObject._validate怎么用?Python IonObject._validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.public.IonObject
的用法示例。
在下文中一共展示了IonObject._validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_ion_object
# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import _validate [as 别名]
def create_ion_object(object_params):
new_obj = IonObject(object_params["type_"])
#Iterate over the parameters to add to object; have to do this instead
#of passing a dict to get around restrictions in object creation on setting _id, _rev params
for param in object_params:
set_object_field(new_obj, param, object_params.get(param))
new_obj._validate() # verify that all of the object fields were set with proper types
return new_obj
示例2: create_ion_object
# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import _validate [as 别名]
def create_ion_object(self, object_params):
"""Create and initialize an ION object from a dictionary of parameters coming via HTTP,
ready to be passed on to services/messaging. The object is validated after creation.
Note: This is not called for service operation argument signatures
"""
new_obj = IonObject(object_params["type_"])
# Iterate over the parameters to add to object; have to do this instead
# of passing a dict to get around restrictions in object creation on setting _id, _rev params
for param in object_params:
self.set_object_field(new_obj, param, object_params.get(param))
new_obj._validate() # verify that all of the object fields were set with proper types
return new_obj