web2py.py -e

This commit is contained in:
mdipierro
2015-02-18 10:29:20 -06:00
parent 8a9d95de41
commit c2a46c5d6d
2 changed files with 14 additions and 5 deletions
+7 -5
View File
@@ -1,6 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
@@ -20,9 +19,10 @@ import types
import os
import logging
from storage import Storage
from http import HTTP
from html import BEAUTIFY, XML
from gluon.storage import Storage
from gluon.http import HTTP
from gluon.html import BEAUTIFY, XML
from gluon.settings import global_settings
logger = logging.getLogger("web2py")
@@ -156,7 +156,6 @@ class RestrictedError(Exception):
"""
Logs the exception.
"""
try:
d = {
'layer': str(self.layer),
@@ -167,11 +166,14 @@ class RestrictedError(Exception):
}
ticket_storage = TicketStorage(db=request.tickets_db)
ticket_storage.store(request, request.uuid.split('/', 1)[1], d)
if global_settings.cmd_options.print_errors:
logger.error(self.traceback)
return request.uuid
except:
logger.error(self.traceback)
return None
def load(self, request, app, ticket_id):
"""
Loads a logged exception.
+7
View File
@@ -737,6 +737,13 @@ def console():
default=False,
help='disable all output')
parser.add_option('-e',
'--errors_to_console',
action='store_true',
dest='print_errors',
default=False,
help='log all errors to console')
msg = ('set debug output level (0-100, 0 means all, 100 means none; '
'default is 30)')
parser.add_option('-D',