本文整理汇总了Python中form.Form.events方法的典型用法代码示例。如果您正苦于以下问题:Python Form.events方法的具体用法?Python Form.events怎么用?Python Form.events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form.Form
的用法示例。
在下文中一共展示了Form.events方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_rules
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import events [as 别名]
def run_rules(data):
"""Mandatory function which runs the rules pertaining
to this module
"""
form = Form(data)
for event in form.events():
for field in event.fields():
field_value = field.value
if not field_value:
continue
else:
is_cancelled = False
is_cancelled = process_field_cancelled_value(field_value)
if is_cancelled is True:
# clear the field value
field.clear_value()
else:
continue
return form
示例2: test_is_not_empty
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import events [as 别名]
def test_is_not_empty(self):
raw_xml = """
<person_form_event>
<person>
<study_id>60</study_id>
<all_form_events>
<form>
<name>hcv_rna_results</name>
<event>
<name>1_arm_1</name>
<field><name/><value>o hai</value></field>
<field><name>hcv_lbdtc</name><value/></field>
</event>
</form>
</all_form_events>
</person>
</person_form_event>"""
form = Form(etree.fromstring(raw_xml))
event = form.events().next()
self.assertFalse(event.is_empty())