本文整理汇总了Python中corehq.form_processor.interfaces.processor.FormProcessorInterface.domain方法的典型用法代码示例。如果您正苦于以下问题:Python FormProcessorInterface.domain方法的具体用法?Python FormProcessorInterface.domain怎么用?Python FormProcessorInterface.domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.form_processor.interfaces.processor.FormProcessorInterface
的用法示例。
在下文中一共展示了FormProcessorInterface.domain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_form_ready_to_save
# 需要导入模块: from corehq.form_processor.interfaces.processor import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.processor.FormProcessorInterface import domain [as 别名]
def get_form_ready_to_save(metadata, is_db_test=False):
from corehq.form_processor.parsers.form import process_xform_xml
from corehq.form_processor.utils import get_simple_form_xml, convert_xform_to_json
from corehq.form_processor.interfaces.processor import FormProcessorInterface
assert metadata is not None
metadata.domain = metadata.domain or uuid.uuid4().hex
form_id = uuid.uuid4().hex
form_xml = get_simple_form_xml(form_id=form_id, metadata=metadata)
if is_db_test:
wrapped_form = process_xform_xml(metadata.domain, form_xml).submitted_form
else:
form_json = convert_xform_to_json(form_xml)
wrapped_form = FormProcessorInterface(domain=metadata.domain).new_xform(form_json)
wrapped_form.domain = metadata.domain
wrapped_form.received_on = metadata.received_on
return wrapped_form