예제 #1
0
def meta_state(context, request, va, **kw):
    api = kw['api']
    brain = kw['brain']
    obj = find_resource(api.root, brain['path'])
    if not IWorkflowAware.providedBy(obj):
        return ''
    state_id = brain['workflow_state']
    state_info = _dummy[brain['content_type']].workflow.state_info(None, request)
    translated_state_title = state_id
    for info in state_info:
        if info['name'] == state_id:
            translated_state_title = api.translate(api.tstring(info['title']))
    return '<span class="%s icon iconpadding">%s</span>' % (state_id, translated_state_title)
예제 #2
0
def meta_state(context, request, va, **kw):
    api = kw['api']
    brain = kw['brain']
    obj = find_resource(api.root, brain['path'])
    if not IWorkflowAware.providedBy(obj):
        return ''
    state_id = brain['workflow_state']
    state_info = _dummy[brain['content_type']].workflow.state_info(
        None, request)
    translated_state_title = state_id
    for info in state_info:
        if info['name'] == state_id:
            translated_state_title = api.translate(api.tstring(info['title']))
    return '<span class="%s icon iconpadding">%s</span>' % (
        state_id, translated_state_title)
예제 #3
0
def get_workflow_state(object, default):
    """ Return workflow state, if this object has workflow enabled. """
    if not IWorkflowAware.providedBy(object):
        return default
    return object.get_workflow_state()
예제 #4
0
def get_workflow_state(obj, default):
    """ Return workflow state, if this object has workflow enabled. """
    if not IWorkflowAware.providedBy(obj):
        return default
    return obj.get_workflow_state()