diff --git a/VERSION b/VERSION index 6938aeab..fa8769ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-20 09:27:02) stable +Version 2.0.9 (2012-09-20 13:25:48) stable diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index 0cb2e8de..a4d527a6 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -1652,7 +1652,6 @@ def git_pull(): session.flash = T("Application updated via git pull") redirect(URL('site')) except CheckoutError, message: - logging.error(message) session.flash = T("Pull failed, certain files could not be checked out. Check logs for details.") redirect(URL('site')) except UnmergedEntriesError: @@ -1662,11 +1661,9 @@ def git_pull(): session.flash = T("Pull is not possible because you have unmerged files. Fix them up in the work tree, and then try again.") redirect(URL('site')) except GitCommandError, status: - logging.error(str(status)) session.flash = T("Pull failed, git exited abnormally. See logs for details.") redirect(URL('site')) except Exception,e: - logging.error("Unexpected error:", sys.exc_info()[0]) session.flash = T("Pull failed, git exited abnormally. See logs for details.") redirect(URL('site')) elif 'cancel' in request.vars: @@ -1698,7 +1695,6 @@ def git_push(): session.flash = T("Push failed, there are unmerged entries in the cache. Resolve merge issues manually and try again.") redirect(URL('site')) except Exception, e: - logging.error("Unexpected error:", sys.exc_info()[0]) session.flash = T("Push failed, git exited abnormally. See logs for details.") redirect(URL('site')) return dict(app=app,form=form) diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html index 755dd0b2..6555ab50 100644 --- a/applications/admin/views/default/edit.html +++ b/applications/admin/views/default/edit.html @@ -19,6 +19,10 @@ + + + + {{elif TEXT_EDITOR == 'ace':}} @@ -246,6 +250,11 @@ window.onload = function() { {{elif TEXT_EDITOR == 'codemirror':}} @@ -253,6 +262,11 @@ window.onload = function() { {{else:}}

{{=T("Key bindings")}}

diff --git a/gluon/rewrite.py b/gluon/rewrite.py index bd7cd408..79ac23d0 100644 --- a/gluon/rewrite.py +++ b/gluon/rewrite.py @@ -192,6 +192,7 @@ def url_out(request, env, application, controller, function, port = '' else: port = ':%s' % port + host = host.split(':')[0] url = '%s://%s%s%s' % (scheme, host, port, url) return url diff --git a/scripts/zip_static_files.py b/scripts/zip_static_files.py index 10497b7a..67d342f0 100644 --- a/scripts/zip_static_files.py +++ b/scripts/zip_static_files.py @@ -3,32 +3,45 @@ ## launch with python web2py.py -S myapp -R scripts/zip_static_files.py -ALLOWED_EXTS = ['.css', '.js'] + import os import gzip -static_path = os.path.abspath(os.path.join(request.folder, 'static')) -filelist = [] -for root, dir, files in os.walk(static_path): - for file in files: - filelist.append(os.path.join(root, file)) -tsave = 0 -for fi in filelist: - extension = os.path.splitext(fi) - extension = len(extension) > 1 and extension[1] or None - if not extension or extension not in ALLOWED_EXTS: - print 'skipping %s' % os.path.basename(fi) - continue - fstats = os.stat(fi) - atime, mtime = fstats.st_atime, fstats.st_mtime - gfi = fi + '.gz' - print 'gzipping %s to %s' % (os.path.basename(fi), os.path.basename(gfi)) - f_in = open(fi, 'rb') - f_out = gzip.open(gfi, 'wb') - f_out.writelines(f_in) - f_out.close() - f_in.close() - os.utime(gfi, (atime,mtime)) - saved = fstats.st_size - os.stat(gfi).st_size - tsave+= saved -print 'saved %s KB' % (int(tsave)/1000.0) +def zip_static(filelist=[]): + tsave = 0 + for fi in filelist: + extension = os.path.splitext(fi) + extension = len(extension) > 1 and extension[1] or None + if not extension or extension not in ALLOWED_EXTS: + print 'skipping %s' % os.path.basename(fi) + continue + fstats = os.stat(fi) + atime, mtime = fstats.st_atime, fstats.st_mtime + gfi = fi + '.gz' + if os.path.isfile(gfi): + zstats = os.stat(gfi) + zatime, zmtime = zstats.st_atime, zstats.st_mtime + if zatime == atime and zmtime == mtime: + print 'skipping %s, already gzipped to the latest version' % os.path.basename(fi) + continue + print 'gzipping %s to %s' % (os.path.basename(fi), os.path.basename(gfi)) + f_in = open(fi, 'rb') + f_out = gzip.open(gfi, 'wb') + f_out.writelines(f_in) + f_out.close() + f_in.close() + os.utime(gfi, (atime,mtime)) + saved = fstats.st_size - os.stat(gfi).st_size + tsave+= saved + + print 'saved %s KB' % (int(tsave)/1000.0) + +if __name__ == '__main__': + ALLOWED_EXTS = ['.css', '.js'] + static_path = os.path.abspath(os.path.join(request.folder, 'static')) + filelist = [] + for root, dir, files in os.walk(static_path): + for file in files: + filelist.append(os.path.join(root, file)) + + zip_static(filelist)