Fixes for some pep and code syntax

This commit is contained in:
Alfonso de la Guarda Reyes
2013-10-05 07:59:04 -05:00
parent fff798c1cc
commit cd957cf52b
+5 -6
View File
@@ -353,7 +353,7 @@ def plugin_install(app, fobj, request, filename):
return False 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. Compares current web2py's version with the latest stable web2py version.
@@ -374,7 +374,7 @@ def check_new_version(myversion, version_URL):
""" """
try: try:
from urllib import urlopen from urllib import urlopen
version = urlopen(version_URL).read() version = urlopen(version_url).read()
pversion = parse_version(version) pversion = parse_version(version)
pmyversion = parse_version(myversion) pmyversion = parse_version(myversion)
except IOError: except IOError:
@@ -398,7 +398,7 @@ def unzip(filename, dir, subfolder=''):
raise RuntimeError('Not a valid zipfile') raise RuntimeError('Not a valid zipfile')
zf = zipfile.ZipFile(filename) zf = zipfile.ZipFile(filename)
if not subfolder.endswith('/'): if not subfolder.endswith('/'):
subfolder = subfolder + '/' subfolder += '/'
n = len(subfolder) n = len(subfolder)
for name in sorted(zf.namelist()): for name in sorted(zf.namelist()):
if not name.startswith(subfolder): if not name.startswith(subfolder):
@@ -432,11 +432,11 @@ def upgrade(request, url='http://web2py.com'):
web2py_version = request.env.web2py_version web2py_version = request.env.web2py_version
gluon_parent = request.env.gluon_parent gluon_parent = request.env.gluon_parent
if not gluon_parent.endswith('/'): if not gluon_parent.endswith('/'):
gluon_parent = gluon_parent + '/' gluon_parent += '/'
(check, version) = check_new_version(web2py_version, (check, version) = check_new_version(web2py_version,
url + '/examples/default/version') url + '/examples/default/version')
if not check: if not check:
return (False, 'Already latest version') return False, 'Already latest version'
if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')): if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')):
version_type = 'win' version_type = 'win'
destination = gluon_parent destination = gluon_parent
@@ -452,7 +452,6 @@ def upgrade(request, url='http://web2py.com'):
full_url = url + '/examples/static/web2py_%s.zip' % version_type full_url = url + '/examples/static/web2py_%s.zip' % version_type
filename = abspath('web2py_%s_downloaded.zip' % version_type) filename = abspath('web2py_%s_downloaded.zip' % version_type)
file = None
try: try:
write_file(filename, urllib.urlopen(full_url).read(), 'wb') write_file(filename, urllib.urlopen(full_url).read(), 'wb')
except Exception, e: except Exception, e: