added as_table option to msgprint
This commit is contained in:
parent
3122251c3f
commit
87fad95d4b
1 changed files with 4 additions and 1 deletions
|
|
@ -94,10 +94,13 @@ def errprint(msg):
|
|||
"""
|
||||
debug_log.append(cstr(msg or ''))
|
||||
|
||||
def msgprint(msg, small=0, raise_exception=0):
|
||||
def msgprint(msg, small=0, raise_exception=0, as_table=False):
|
||||
"""
|
||||
Append to the :data:`message_log`
|
||||
"""
|
||||
if as_table and type(msg) in (list, tuple):
|
||||
msg = '<table border="1px" style="border-collapse: collapse" cellpadding="2px">' + ''.join(['<tr>'+''.join(['<td>%s</td>' % c for c in r])+'</tr>' for r in msg]) + '</table>'
|
||||
|
||||
message_log.append((small and '__small:' or '')+cstr(msg or ''))
|
||||
if raise_exception:
|
||||
raise ValidationError
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue