- # try:
- book_import_form.save()
- # except:
- # return HttpResponse("Error importing book: %r" % (sys.exc_info(),))
+ try:
+ book_import_form.save()
+ except:
+ info = sys.exc_info()
+ exception = pprint.pformat(info[1])
+ tb = '\n'.join(traceback.format_tb(info[2]))
+ return HttpResponse("An error occurred: %s\n\n%s" % (exception, tb), mimetype='text/plain')