fixed issue 1755:IE11 vs gluon.contrib.user_agent - 'browser' key not existing anymore
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = ''
|
||||
|
||||
|
||||
@@ -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) {
|
||||
<ul class="nav nav-list" rel="pagebookmark" id="filelist">
|
||||
<li><input type="text" placeholder="{{=T('Rapid Search')}}" class="input-block-level typeahead-tw search-query"></li>
|
||||
{{dirs=[{'name':'models', 'reg':'.*\.py$'},
|
||||
{'name':'controllers', 'reg':'.*\.py$'},
|
||||
{'name':'views', 'reg':'[\w/\-]+(\.\w+)+$'},
|
||||
{'name':'modules', 'reg':'.*\.py$'},
|
||||
{'name':'private', 'reg': '[^\.#].*'}]}}
|
||||
{'name':'controllers', 'reg':'.*\.py$'},
|
||||
{'name':'views', 'reg':'[\w/\-]+(\.\w+)+$'},
|
||||
{'name':'modules', 'reg':'.*\.py$'}, ]}}
|
||||
{{auto_complete_list=[]}}
|
||||
{{for dir in dirs:}}
|
||||
<li class="nav-header component" onclick="collapse('{{="%s_files" % dir['name']}}');">{{=dir['name']}}</li>
|
||||
|
||||
@@ -405,7 +405,7 @@ def detect(agent):
|
||||
result['exception'] = ex
|
||||
# hack to address https://code.google.com/p/web2py/issues/detail?id=1755
|
||||
if not 'browser' in result:
|
||||
result['browser'] = Storage({'name':'IE11'})
|
||||
result['browser'] = {'name':'IE11'}
|
||||
return result
|
||||
|
||||
|
||||
|
||||
+4
-1
@@ -109,6 +109,7 @@ def listdir(
|
||||
drop=True,
|
||||
add_dirs=False,
|
||||
sort=True,
|
||||
maxnum = None,
|
||||
):
|
||||
"""
|
||||
like os.listdir() but you can specify a regex pattern to filter files.
|
||||
@@ -121,7 +122,7 @@ def listdir(
|
||||
else:
|
||||
n = 0
|
||||
regex = re.compile(expression)
|
||||
items = []
|
||||
items = []
|
||||
for (root, dirs, files) in os.walk(path, topdown=True):
|
||||
for dir in dirs[:]:
|
||||
if dir.startswith('.'):
|
||||
@@ -131,6 +132,8 @@ def listdir(
|
||||
for file in sorted(files):
|
||||
if regex.match(file) and not file.startswith('.'):
|
||||
items.append(os.path.join(root, file)[n:])
|
||||
if maxnum and len(items)>=maxnum:
|
||||
break
|
||||
if sort:
|
||||
return sorted(items)
|
||||
else:
|
||||
|
||||
+5
-5
@@ -294,14 +294,14 @@ class Request(Storage):
|
||||
def user_agent(self):
|
||||
from gluon.contrib import user_agent_parser
|
||||
session = current.session
|
||||
user_agent = session._user_agent or \
|
||||
user_agent_parser.detect(self.env.http_user_agent)
|
||||
if session:
|
||||
session._user_agent = user_agent
|
||||
user_agent = Storage(user_agent)
|
||||
user_agent = session._user_agent
|
||||
if user_agent:
|
||||
return user_agent
|
||||
user_agent = user_agent_parser.detect(self.env.http_user_agent)
|
||||
for key, value in user_agent.items():
|
||||
if isinstance(value, dict):
|
||||
user_agent[key] = Storage(value)
|
||||
user_agent = session._user_agent = Storage(user_agent)
|
||||
return user_agent
|
||||
|
||||
def requires_https(self):
|
||||
|
||||
Reference in New Issue
Block a user