def htmlHeader(level, text, escape=True, **attr): r""" Level have to be in [1; 6]. >>> htmlHeader(1, 'Document') <Html u'<h1>Document</h1>'> >>> htmlHeader(7, 'Subsection') <Html u'<h6>Subsection</h6>'> """ tag = 'h%s' % minmax(1, level, 6) return _htmlTag(tag, Html(text, escape=escape), attr)
def changeLogLevel(level, delta): return minmax(DEBUG, level + delta*10, CRITICAL)