'Create a new stored workflow with name `workflow_name`.'

@web.expose
@web.require_login('create    workflows')
def create(self, trans, workflow_name=None, workflow_annotation=''):

    user = trans.get_user()
    if (workflow_name is not None):
        stored_workflow = model.StoredWorkflow()
        stored_workflow.name = workflow_name
        stored_workflow.user = user
        self.create_item_slug(trans.sa_session, stored_workflow)
        workflow = model.Workflow()
        workflow.name = workflow_name
        workflow.stored_workflow = stored_workflow
        stored_workflow.latest_workflow = workflow
        workflow_annotation = sanitize_html(workflow_annotation, 'utf-8', 'text/html')
        self.add_item_annotation(trans.sa_session, trans.get_user(), stored_workflow, workflow_annotation)
        session = trans.sa_session
        session.add(stored_workflow)
        session.flush()
        return self.editor(trans, id=trans.security.encode_id(stored_workflow.id))
    else:
        return form(url_for(controller='workflow', action='create'), 'Create    New    Workflow', submit_text='Create', use_panels=True).add_text('workflow_name', 'Workflow    Name', value='Unnamed    workflow').add_text('workflow_annotation', 'Workflow    Annotation', value='', help='A    description    of    the    workflow;    annotation    is    shown    alongside    shared    or    published    workflows.')
