(sec)
return mark_safe(s)
Converts seconds into a duration string

    >>> format_duration(1000)
    '16m 40s'

    >>> format_duration(10009)
    '2h 46m 49s'
Converts seconds into a duration string
Converts seconds into a duration string
def format_duration(sec):
    """Converts seconds into a duration string

    >>> format_duration(1000)
    '16m 40s'

    >>> format_duration(10009)
    '2h 46m 49s'
    """
    hours = int(sec / 60 / 60)
    minutes = int((sec / 60) % 60)
    seconds = int(sec % 60)

    if hours:
        s = _("{h}h {m}m {s}s").format(h=hours, m=minutes, s=seconds)
    else:
        s = _("{m}m {s}s").format(m=minutes, s=seconds)
    return mark_safe(s)
def format_duration ( sec ) : hours = int ( sec / 60 / 60 ) minutes = int ( ( sec / 60 ) % 60 ) seconds = int ( sec % 60 ) if hours : s = _ ( "{h}h {m}m {s}s" ) . format ( h = hours , m = minutes , s = seconds ) else : s = _ ( "{m}m {s}s" ) . format ( m = minutes , s = seconds ) return mark_safe ( s )