本文整理汇总了Python中oozie.models2.Bundle.to_json_for_html方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.to_json_for_html方法的具体用法?Python Bundle.to_json_for_html怎么用?Python Bundle.to_json_for_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.models2.Bundle
的用法示例。
在下文中一共展示了Bundle.to_json_for_html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_bundle
# 需要导入模块: from oozie.models2 import Bundle [as 别名]
# 或者: from oozie.models2.Bundle import to_json_for_html [as 别名]
def edit_bundle(request):
bundle_id = request.GET.get('bundle')
doc = None
if bundle_id:
doc = Document2.objects.get(id=bundle_id)
bundle = Bundle(document=doc)
else:
bundle = Bundle()
bundle.set_workspace(request.user)
if USE_NEW_EDITOR.get():
coordinators = [dict([('id', d.id), ('uuid', d.uuid), ('name', d.name)])
for d in Document2.objects.documents(request.user).search_documents(types=['oozie-coordinator2'])]
else:
coordinators = [dict([('id', d.content_object.id), ('uuid', d.content_object.uuid), ('name', d.content_object.name)])
for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]
can_edit_json = doc is None or (doc.can_write(request.user) if USE_NEW_EDITOR.get() else doc.doc.get().is_editable(request.user))
return render('editor2/bundle_editor.mako', request, {
'bundle_json': bundle.to_json_for_html(),
'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),
'doc_uuid': doc.uuid if doc else '',
'is_embeddable': request.GET.get('is_embeddable', False),
'can_edit_json': json.dumps(can_edit_json)
})
示例2: edit_bundle
# 需要导入模块: from oozie.models2 import Bundle [as 别名]
# 或者: from oozie.models2.Bundle import to_json_for_html [as 别名]
def edit_bundle(request):
bundle_id = request.GET.get('bundle')
doc = None
if bundle_id:
doc = Document2.objects.get(id=bundle_id)
bundle = Bundle(document=doc)
else:
bundle = Bundle()
bundle.set_workspace(request.user)
coordinators = [dict([('id', d.content_object.id), ('uuid', d.content_object.uuid), ('name', d.content_object.name)])
for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]
return render('editor2/bundle_editor.mako', request, {
'bundle_json': bundle.to_json_for_html(),
'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),
'doc1_id': doc.doc.get().id if doc else -1,
'can_edit_json': json.dumps(doc is None or doc.doc.get().is_editable(request.user))
})