Improve PEP8 gluon/shell.py
This commit is contained in:
+7
-6
@@ -32,7 +32,8 @@ from pydal.base import BaseAdapter
|
|||||||
|
|
||||||
logger = logging.getLogger("web2py")
|
logger = logging.getLogger("web2py")
|
||||||
|
|
||||||
def enable_autocomplete_and_history(adir,env):
|
|
||||||
|
def enable_autocomplete_and_history(adir, env):
|
||||||
try:
|
try:
|
||||||
import rlcompleter
|
import rlcompleter
|
||||||
import atexit
|
import atexit
|
||||||
@@ -43,7 +44,7 @@ def enable_autocomplete_and_history(adir,env):
|
|||||||
readline.parse_and_bind("bind ^I rl_complete"
|
readline.parse_and_bind("bind ^I rl_complete"
|
||||||
if sys.platform == 'darwin'
|
if sys.platform == 'darwin'
|
||||||
else "tab: complete")
|
else "tab: complete")
|
||||||
history_file = os.path.join(adir,'.pythonhistory')
|
history_file = os.path.join(adir, '.pythonhistory')
|
||||||
try:
|
try:
|
||||||
readline.read_history_file(history_file)
|
readline.read_history_file(history_file)
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -132,7 +133,7 @@ def env(
|
|||||||
port = global_settings.cmd_options.port
|
port = global_settings.cmd_options.port
|
||||||
else:
|
else:
|
||||||
ip, port = '127.0.0.1', '8000'
|
ip, port = '127.0.0.1', '8000'
|
||||||
request.env.http_host = '%s:%s' % (ip,port)
|
request.env.http_host = '%s:%s' % (ip, port)
|
||||||
request.env.remote_addr = '127.0.0.1'
|
request.env.remote_addr = '127.0.0.1'
|
||||||
request.env.web2py_runtime_gae = global_settings.web2py_runtime_gae
|
request.env.web2py_runtime_gae = global_settings.web2py_runtime_gae
|
||||||
|
|
||||||
@@ -143,8 +144,8 @@ def env(
|
|||||||
if request.args:
|
if request.args:
|
||||||
path_info = '%s/%s' % (path_info, '/'.join(request.args))
|
path_info = '%s/%s' % (path_info, '/'.join(request.args))
|
||||||
if request.vars:
|
if request.vars:
|
||||||
vars = ['%s=%s' % (k,v) if v else '%s' % k
|
vars = ['%s=%s' % (k, v) if v else '%s' % k
|
||||||
for (k,v) in request.vars.iteritems()]
|
for (k, v) in request.vars.iteritems()]
|
||||||
path_info = '%s?%s' % (path_info, '&'.join(vars))
|
path_info = '%s?%s' % (path_info, '&'.join(vars))
|
||||||
request.env.path_info = path_info
|
request.env.path_info = path_info
|
||||||
|
|
||||||
@@ -313,7 +314,7 @@ def run(
|
|||||||
except:
|
except:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'import IPython error; use default python shell')
|
'import IPython error; use default python shell')
|
||||||
enable_autocomplete_and_history(adir,_env)
|
enable_autocomplete_and_history(adir, _env)
|
||||||
code.interact(local=_env)
|
code.interact(local=_env)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user