From c6f79af3721e5b9e345174819494b3e5a3b6fabe Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 30 Jun 2012 11:54:36 -0500 Subject: [PATCH] for some reason shell forgets settings, this works around temporarily fixes the problem, thanks Vladyslav Kozlovskyy --- VERSION | 2 +- gluon/compileapp.py | 2 +- gluon/settings.py | 1 + gluon/shell.py | 7 +++++-- gluon/widget.py | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index a0ccbc16..0cc21b5c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-06-29 20:55:40) dev +Version 2.00.0 (2012-06-30 11:54:31) dev diff --git a/gluon/compileapp.py b/gluon/compileapp.py index cc338fd7..76b4fe72 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -361,7 +361,7 @@ def build_environment(request, response, session, store_current=True): """ Build the environment dictionary into which web2py files are executed. """ - + environment = {} for key in html.__all__: environment[key] = getattr(html, key) diff --git a/gluon/settings.py b/gluon/settings.py index c9befa9b..4762cbd4 100644 --- a/gluon/settings.py +++ b/gluon/settings.py @@ -13,3 +13,4 @@ settings = global_settings # legacy compatibility + diff --git a/gluon/shell.py b/gluon/shell.py index cb74da36..e5e2bc20 100644 --- a/gluon/shell.py +++ b/gluon/shell.py @@ -61,7 +61,7 @@ def exec_environment( appname = mo.group('appname') request.folder = os.path.join('applications', appname) else: - request.folder = '' + request.folder = '' env = build_environment(request, response, session, store_current=False) if pyfile: pycfile = pyfile + 'c' @@ -123,7 +123,7 @@ def env( return True fileutils.check_credentials = check_credentials - + environment = build_environment(request, response, session) if import_models: @@ -206,6 +206,9 @@ def run( exec ('print %s()' % f, _env) return + # "woodoo magic" workaround: reinitialize main.py + g={}; exec "import main" in g; del g + _env.update(exec_pythonrc()) if startfile: try: diff --git a/gluon/widget.py b/gluon/widget.py index 1e6391c5..dfa2cb99 100644 --- a/gluon/widget.py +++ b/gluon/widget.py @@ -20,12 +20,12 @@ import signal import math import logging import newcron -import main import getpass +import main from fileutils import w2p_pack, read_file, write_file -from shell import run, test from settings import global_settings +from shell import run, test try: import Tkinter, tkMessageBox