From fff798c1ccb8e30cf0e2291a186364ce88326ae7 Mon Sep 17 00:00:00 2001 From: Alfonso de la Guarda Reyes Date: Sat, 5 Oct 2013 07:51:12 -0500 Subject: [PATCH 1/4] Added restriction for .idea inside gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f28d9485..4b13a236 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ applications/admin/cron/cron.master HOWTO-web2py-devel *.sublime-project *.sublime-workspace +.idea/* From cd957cf52b7e10400c32b26a04e2fe740d1ff86a Mon Sep 17 00:00:00 2001 From: Alfonso de la Guarda Reyes Date: Sat, 5 Oct 2013 07:59:04 -0500 Subject: [PATCH 2/4] Fixes for some pep and code syntax --- gluon/admin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gluon/admin.py b/gluon/admin.py index f22c64f0..0661d80e 100644 --- a/gluon/admin.py +++ b/gluon/admin.py @@ -353,7 +353,7 @@ def plugin_install(app, fobj, request, filename): return False -def check_new_version(myversion, version_URL): +def check_new_version(myversion, version_url): """ Compares current web2py's version with the latest stable web2py version. @@ -374,7 +374,7 @@ def check_new_version(myversion, version_URL): """ try: from urllib import urlopen - version = urlopen(version_URL).read() + version = urlopen(version_url).read() pversion = parse_version(version) pmyversion = parse_version(myversion) except IOError: @@ -398,7 +398,7 @@ def unzip(filename, dir, subfolder=''): raise RuntimeError('Not a valid zipfile') zf = zipfile.ZipFile(filename) if not subfolder.endswith('/'): - subfolder = subfolder + '/' + subfolder += '/' n = len(subfolder) for name in sorted(zf.namelist()): if not name.startswith(subfolder): @@ -432,11 +432,11 @@ def upgrade(request, url='http://web2py.com'): web2py_version = request.env.web2py_version gluon_parent = request.env.gluon_parent if not gluon_parent.endswith('/'): - gluon_parent = gluon_parent + '/' + gluon_parent += '/' (check, version) = check_new_version(web2py_version, url + '/examples/default/version') if not check: - return (False, 'Already latest version') + return False, 'Already latest version' if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')): version_type = 'win' destination = gluon_parent @@ -452,7 +452,6 @@ def upgrade(request, url='http://web2py.com'): full_url = url + '/examples/static/web2py_%s.zip' % version_type filename = abspath('web2py_%s_downloaded.zip' % version_type) - file = None try: write_file(filename, urllib.urlopen(full_url).read(), 'wb') except Exception, e: From 56796619147216067ad0c447922f7d3a72d7d625 Mon Sep 17 00:00:00 2001 From: Alfonso de la Guarda Reyes Date: Sat, 5 Oct 2013 08:03:50 -0500 Subject: [PATCH 3/4] Minor fixes for pep and style --- gluon/cache.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gluon/cache.py b/gluon/cache.py index 1cf9b175..15815af3 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -19,7 +19,6 @@ When web2py is running on Google App Engine, caching will be provided by the GAE memcache (see gluon.contrib.gae_memcache) """ -import traceback import time import portalocker import shelve @@ -278,7 +277,7 @@ class CacheOnDisk(CacheAbstract): storage = shelve.open(self.shelve_name) except: logger.error('corrupted cache file %s, will try rebuild it' - % (self.shelve_name)) + % self.shelve_name) storage = None if not storage and os.path.exists(self.shelve_name): os.unlink(self.shelve_name) @@ -479,7 +478,6 @@ class Cache(object): if not session_ and public_: cache_control += ', public' expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT') - vary = None else: cache_control += ', private' expires = 'Fri, 01 Jan 1990 00:00:00 GMT' From c1f8d348920d3df1e7616f117cbfee70712a8c8d Mon Sep 17 00:00:00 2001 From: Alfonso de la Guarda Reyes Date: Sat, 5 Oct 2013 08:08:37 -0500 Subject: [PATCH 4/4] Minor fixes for pep and styles widget.py --- gluon/widget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gluon/widget.py b/gluon/widget.py index 284c255e..3591071c 100644 --- a/gluon/widget.py +++ b/gluon/widget.py @@ -1005,7 +1005,7 @@ def console(): if not os.path.exists('applications/__init__.py'): write_file('applications/__init__.py', '') - return (options, args) + return options, args def check_existent_app(options, appname): @@ -1022,7 +1022,7 @@ def get_code_for_scheduler(app, options): code = code % ("','".join(app[1:])) app_ = app[0] if not check_existent_app(options, app_): - print "Application '%s' doesn't exist, skipping" % (app_) + print "Application '%s' doesn't exist, skipping" % app_ return None, None return app_, code