Konfigurasjonsflagg for hvorvidt tracebacks skal vises.
Fjernet et str-kall som fikk Python til å krangle om tegnkoding.
This commit is contained in:
parent
28d998f310
commit
105c625e1e
1
conf.py
1
conf.py
|
@ -1,2 +1,3 @@
|
||||||
db_url = 'sqlite:///data'
|
db_url = 'sqlite:///data'
|
||||||
quit_allowed = True
|
quit_allowed = True
|
||||||
|
show_tracebacks = True
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
from helpers import *
|
from helpers import *
|
||||||
|
|
||||||
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death']
|
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death']
|
||||||
|
@ -68,7 +69,7 @@ class Menu():
|
||||||
elif isinstance(self.items[i], tuple):
|
elif isinstance(self.items[i], tuple):
|
||||||
return self.items[i][1]
|
return self.items[i][1]
|
||||||
else:
|
else:
|
||||||
return str(self.items[i])
|
return self.items[i]
|
||||||
|
|
||||||
def item_value(self, i):
|
def item_value(self, i):
|
||||||
if isinstance(self.items[i], tuple):
|
if isinstance(self.items[i], tuple):
|
||||||
|
@ -645,6 +646,8 @@ while True:
|
||||||
except:
|
except:
|
||||||
print 'Something went wrong.'
|
print 'Something went wrong.'
|
||||||
print '%s: %s' % sys.exc_info()[0:2]
|
print '%s: %s' % sys.exc_info()[0:2]
|
||||||
|
if conf.show_tracebacks:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
print 'Restarting main menu.'
|
print 'Restarting main menu.'
|
||||||
|
|
Loading…
Reference in New Issue