本文整理匯總了Python中spreads.workflow.Workflow.id方法的典型用法代碼示例。如果您正苦於以下問題:Python Workflow.id方法的具體用法?Python Workflow.id怎麽用?Python Workflow.id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類spreads.workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_workflow
# 需要導入模塊: from spreads.workflow import Workflow [as 別名]
# 或者: from spreads.workflow.Workflow import id [as 別名]
def create_workflow():
""" Create a new workflow.
Payload should be a JSON object. The only required attribute is 'name' for
the desired workflow name. Optionally, 'config' can be set to a
configuration object in the form "plugin_name: { setting: value, ...}".
Returns the newly created workflow as a JSON object.
"""
data = json.loads(request.data)
path = Path(app.config['base_path'])/unicode(data['name'])
# Setup default configuration
config = app.config['default_config']
# Overlay user-supplied values, if existant
user_config = data.get('config', None)
if user_config is not None:
config = config.with_overlay(user_config)
workflow = Workflow(config=config, path=path,
step=data.get('step', None),
step_done=data.get('step_done', None))
try:
workflow.id = persistence.save_workflow(workflow)
except persistence.ValidationError as e:
return make_response(json.dumps(dict(errors=e.errors)), 400,
{'Content-Type': 'application/json'})
return make_response(json.dumps(workflow),
200, {'Content-Type': 'application/json'})