Changeset 136:b4891e59a704

Show
Ignore:
Timestamp:
05/05/09 04:43:54 (10 months ago)
Author:
Nicolas ?vrard <nicoe@…>
Branch:
default
Message:

Removed use of print statements in templates/init.py

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • relatorio/templates/__init__.py

    r134 r136  
    2121import traceback 
    2222import warnings 
     23from cStringIO import StringIO 
    2324 
    2425plugins = ['base', 'opendocument', 'pdf', 'chart'] 
     
    2829        __import__('relatorio.templates.%s' % name) 
    2930    except Exception, e: 
    30         warnings.warn("Unable to load plugin '%s', you will not be able " 
    31                       "to use it" % name) 
    32         print 
    33         print 'Original traceback:' 
    34         print '-------------------' 
    35         traceback.print_exc() 
    36         print 
     31        tb_file = StringIO() 
     32 
     33        print >> tb_file, ("Unable to load plugin '%s', you will not be able " 
     34                           "to use it" % name) 
     35        print >> tb_file 
     36        print >> tb_file, 'Original traceback:' 
     37        print >> tb_file, '-------------------' 
     38        traceback.print_exc(file=tb_file) 
     39        print >> tb_file 
     40        warnings.warn(tb_file.getvalue())