From bb4f3d6e1ad0957f595baedbe7a191d940072eee Mon Sep 17 00:00:00 2001 From: Massimo Date: Thu, 31 Oct 2013 10:19:07 -0500 Subject: [PATCH] fixed issue 1755:IE11 vs gluon.contrib.user_agent - 'browser' key not existing anymore --- VERSION | 2 +- applications/admin/controllers/default.py | 21 +++++++++++++-------- applications/admin/views/default/edit.html | 9 ++++----- gluon/contrib/user_agent_parser.py | 2 +- gluon/fileutils.py | 5 ++++- gluon/globals.py | 10 +++++----- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/VERSION b/VERSION index 8fe7df6a..c9009d18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.10.31.09.41.31 +Version 2.7.4-stable+timestamp.2013.10.31.10.18.23 diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py index e68008d8..221458de 100644 --- a/applications/admin/controllers/default.py +++ b/applications/admin/controllers/default.py @@ -1,6 +1,7 @@ # coding: utf8 EXPERIMENTAL_STUFF = True +MAXNFILES = 1000 if EXPERIMENTAL_STUFF: if is_mobile: @@ -762,11 +763,13 @@ def edit(): view_link=view_link, editviewlinks=editviewlinks, id=IS_SLUG()(filename)[0], - force= True if (request.vars.restore or request.vars.revert) else False) + force= True if (request.vars.restore or + request.vars.revert) else False) plain_html = response.render('default/edit_js.html', file_details) file_details['plain_html'] = plain_html if is_mobile: - return response.render('default.mobile/edit.html', file_details, editor_settings=preferences) + return response.render('default.mobile/edit.html', + file_details, editor_settings=preferences) else: return response.json(file_details) @@ -1036,9 +1039,9 @@ def design(): privates.sort() # Get all static files - MAXNFILES = 1000 - statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*') - statics = [x.replace('\\', '/') for x in statics[:MAXNFILES]] + statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*', + maxnum = MAXNFILES) + statics = [x.replace(os.path.sep, '/') for x in statics] statics.sort() # Get all languages @@ -1172,8 +1175,9 @@ def plugin(): privates.sort() # Get all static files - statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*') - statics = [x.replace('\\', '/') for x in statics] + statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*', + maxnum = MAXNFILES) + statics = [x.replace(os.path.sep, '/') for x in statics] statics.sort() # Get all languages @@ -1324,7 +1328,8 @@ def create_file(): from gluon import *\n""")[1:] elif (path[-8:] == '/static/') or (path[-9:] == '/private/'): - if request.vars.plugin and not filename.startswith('plugin_%s/' % request.vars.plugin): + if (request.vars.plugin and + not filename.startswith('plugin_%s/' % request.vars.plugin)): filename = 'plugin_%s/%s' % (request.vars.plugin, filename) text = '' diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html index ceb3a18a..4fe40224 100644 --- a/applications/admin/views/default/edit.html +++ b/applications/admin/views/default/edit.html @@ -6,7 +6,7 @@ def listfiles(app, dir, regexp='.*\.py$'): files = sorted( listdir(apath('%(app)s/%(dir)s/' % {'app':app, 'dir':dir}, r=request), regexp)) - files = [x.replace('\\', '/') for x in files if not x.endswith('.bak')] + files = [x.replace(os.path.sep, '/') for x in files if not x.endswith('.bak')] return files def editfile(path,file,vars={}): @@ -198,10 +198,9 @@ $(document).on('click', 'a.font_button', function (e) {