Permalink
Browse files

Updated warn() method.

Added prefix and print_traceback kwargs.
  • Loading branch information...
1 parent 3bb9a13 commit db0b8a688f319f70688c946ccc02d8a113d68afd @rca committed May 10, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 baseline/settings.py
View
@@ -2,14 +2,17 @@
from conf.settings.default import *
-def warn(message, color='yellow', name='Warning'):
- import sys, traceback
+def warn(message, color='yellow', name='Warning', prefix='', print_traceback=True):
+ import sys
from django.utils.termcolors import make_style
red = make_style(fg=color, opts=('bold',))
- traceback.print_exc()
- sys.stderr.write('{0}: {1}\n'.format(red(name), message))
+ if print_traceback:
+ import traceback
+ traceback.print_exc()
+
+ sys.stderr.write('{0}{1}: {2}\n'.format(prefix, red(name), message))
try:
from secretkey import SECRET_KEY

0 comments on commit db0b8a6

Please sign in to comment.