本文整理汇总了Python中corehq.pillows.xform.XFormPillow.default_mapping方法的典型用法代码示例。如果您正苦于以下问题:Python XFormPillow.default_mapping方法的具体用法?Python XFormPillow.default_mapping怎么用?Python XFormPillow.default_mapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.pillows.xform.XFormPillow
的用法示例。
在下文中一共展示了XFormPillow.default_mapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish_handle
# 需要导入模块: from corehq.pillows.xform import XFormPillow [as 别名]
# 或者: from corehq.pillows.xform.XFormPillow import default_mapping [as 别名]
def finish_handle(self):
filepath = os.path.join(settings.FILEPATH, "corehq", "pillows", "mappings", "xform_mapping.py")
xform_pillow = XFormPillow(create_index=False)
# current index
# check current index
aliased_indices = xform_pillow.check_alias()
# current_index = '%s_%s' % (xform_pillow.es_index_prefix, xform_pillow.calc_meta())
current_index = xform_pillow.es_index
sys.stderr.write("current index:\n")
sys.stderr.write('XFORM_INDEX="%s"\n' % current_index)
# regenerate the mapping dict
mapping = xform_mapping.XFORM_MAPPING
xform_pillow.default_mapping = mapping
delattr(xform_pillow, "_calc_meta_cache")
# xform_pillow.calc_meta.reset_cache()
calc_index = "%s_%s" % (xform_pillow.es_index_prefix, xform_pillow.calc_meta())
if calc_index not in aliased_indices and calc_index != current_index:
sys.stderr.write("\n\tWarning, current index %s is not aliased at the moment\n" % current_index)
sys.stderr.write("\tCurrent live aliased index: %s\n\n" % (",".join(aliased_indices)))
if calc_index != current_index:
sys.stderr.write(
"XFORM_INDEX hash has changed, please update \n\t%s\n\tXFORM_INDEX property with the line below:\n"
% filepath
)
sys.stdout.write('XFORM_INDEX="%s"\n' % calc_index)
else:
sys.stderr.write("XFORM_INDEX unchanged\n")