From 568c33d7d66cd3017b995a7dfb88469d7832975e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 29 Nov 2012 18:21:06 -0600 Subject: [PATCH] allow -R ...pyc, fixed issue 1186, thanks Corne.Dickens --- VERSION | 2 +- applications/admin/cron/expire_sessions.py | 6 +++--- gluon/shell.py | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index a89f1477..425fe3ef 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-11-29 17:12:52) stable +Version 2.2.1 (2012-11-29 18:20:27) stable diff --git a/applications/admin/cron/expire_sessions.py b/applications/admin/cron/expire_sessions.py index a602a939..10a428c3 100644 --- a/applications/admin/cron/expire_sessions.py +++ b/applications/admin/cron/expire_sessions.py @@ -1,10 +1,10 @@ EXPIRATION_MINUTES=60 DIGITS=('0','1','2','3','4','5','6','7','8','9') import os, time, stat, cPickle, logging -path=os.path.join(request.folder,'sessions') +path = os.path.join(request.folder,'sessions') if not os.path.exists(path): os.mkdir(path) -now=time.time() +now = time.time() for filename in os.listdir(path): fullpath=os.path.join(path,filename) if os.path.isfile(fullpath) and filename.startswith(DIGITS): @@ -18,4 +18,4 @@ for filename in os.listdir(path): if (now - filetime) > expiration: os.unlink(fullpath) except: - logging.exception('failure to check %s'%fullpath) + logging.exception('failure to check %s' % fullpath) diff --git a/gluon/shell.py b/gluon/shell.py index b3930329..2970e3f6 100644 --- a/gluon/shell.py +++ b/gluon/shell.py @@ -220,7 +220,13 @@ def run( _env.update(exec_pythonrc()) if startfile: try: - execfile(startfile, _env) + ccode = None + if startfile.endswith('.pyc'): + ccode = read_pyc(startfile) + exec ccode in _env + else: + execfile(startfile, _env) + if import_models: BaseAdapter.close_all_instances('commit') except Exception, e: