Last active
December 17, 2015 12:49
-
-
Save x746e/5612369 to your computer and use it in GitHub Desktop.
better web2py devserver, with werkzeug debugger. and it doesn't rewrite translation!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gluon/languages.py b/gluon/languages.py | |
--- a/gluon/languages.py | |
+++ b/gluon/languages.py | |
@@ -283,6 +283,7 @@ | |
def write_plural_dict(filename, contents): | |
+ return | |
if '__corrupted__' in contents: | |
return | |
try: | |
@@ -303,6 +304,7 @@ | |
def write_dict(filename, contents): | |
+ return | |
if '__corrupted__' in contents: | |
return | |
try: | |
diff --git a/gluon/main.py b/gluon/main.py | |
--- a/gluon/main.py | |
+++ b/gluon/main.py | |
@@ -610,6 +610,7 @@ | |
except: | |
+ raise # the exception will be handled by werkzeug's debug facilities | |
if request.body: | |
request.body.close() | |
@@ -834,6 +835,12 @@ | |
log_filename, | |
profiler_filename)} | |
+ from werkzeug.serving import run_simple | |
+ from werkzeug.debug import DebuggedApplication | |
+ app = DebuggedApplication(app_info["wsgi_app"], evalex=True) | |
+ run_simple(ip, port, app, use_reloader=True) | |
+ return | |
+ | |
self.server = rocket.Rocket(interfaces or tuple(sock_list), | |
method='wsgi', | |
app_info=app_info, | |
diff --git a/gluon/restricted.py b/gluon/restricted.py | |
--- a/gluon/restricted.py | |
+++ b/gluon/restricted.py | |
@@ -216,13 +216,9 @@ | |
# do not encapsulate (obfuscate) the original RestrictedError | |
raise | |
except Exception, error: | |
- # extract the exception type and value (used as output message) | |
- etype, evalue, tb = sys.exc_info() | |
- # XXX Show exception in Wing IDE if running in debugger | |
- if __debug__ and 'WINGDB_ACTIVE' in os.environ: | |
- sys.excepthook(etype, evalue, tb) | |
- output = "%s %s" % (etype, evalue) | |
- raise RestrictedError(layer, code, output, environment) | |
+ #from traceback import format_exc | |
+ #raise HTTP(500, u"<pre>%s</pre>" % format_exc()) | |
+ raise # the exception will be handled by werkzeug's debug facilities | |
def snapshot(info=None, context=5, code=None, environment=None): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment