@@ -1 +1 @@
|
||||
Version 2.0.9 (2012-09-20 09:27:02) stable
|
||||
Version 2.0.9 (2012-09-20 13:25:48) stable
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<script src="{{=cm}}/mode/css/css.js"></script>
|
||||
<script src="{{=cm}}/mode/javascript/javascript.js"></script>
|
||||
<script src="{{=cm}}/mode/htmlmixed/htmlmixed.js"></script>
|
||||
<script src="{{=cm}}/lib/util/search.js"></script>
|
||||
<script src="{{=cm}}/lib/util/searchcursor.js"></script>
|
||||
<script src="{{=cm}}/lib/util/dialog.js"></script>
|
||||
<link rel="stylesheet" href="{{=cm}}/lib/util/dialog.css">
|
||||
<script src="{{=cm}}/emmet.min.js"></script>
|
||||
<script language="Javascript" type="text/javascript" src="{{=URL('static','js/ajax_editor.js')}}"></script>
|
||||
{{elif TEXT_EDITOR == 'ace':}}
|
||||
@@ -246,6 +250,11 @@ window.onload = function() {
|
||||
<ul>
|
||||
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
|
||||
{{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
|
||||
{{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
|
||||
{{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
|
||||
{{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
|
||||
{{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
|
||||
{{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
|
||||
{{=shortcut('Tab', T('Expand Abbreviation'))}}
|
||||
</ul>
|
||||
{{elif TEXT_EDITOR == 'codemirror':}}
|
||||
@@ -253,6 +262,11 @@ window.onload = function() {
|
||||
<ul>
|
||||
{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
|
||||
{{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
|
||||
{{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
|
||||
{{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
|
||||
{{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
|
||||
{{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
|
||||
{{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
|
||||
</ul>
|
||||
{{else:}}
|
||||
<h3>{{=T("Key bindings")}}</h3>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+39
-26
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user