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
|
# coding: utf8
|
||||||
|
|
||||||
EXPERIMENTAL_STUFF = True
|
EXPERIMENTAL_STUFF = True
|
||||||
|
MAXNFILES = 1000
|
||||||
|
|
||||||
if EXPERIMENTAL_STUFF:
|
if EXPERIMENTAL_STUFF:
|
||||||
if is_mobile:
|
if is_mobile:
|
||||||
@@ -762,11 +763,13 @@ def edit():
|
|||||||
view_link=view_link,
|
view_link=view_link,
|
||||||
editviewlinks=editviewlinks,
|
editviewlinks=editviewlinks,
|
||||||
id=IS_SLUG()(filename)[0],
|
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)
|
plain_html = response.render('default/edit_js.html', file_details)
|
||||||
file_details['plain_html'] = plain_html
|
file_details['plain_html'] = plain_html
|
||||||
if is_mobile:
|
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:
|
else:
|
||||||
return response.json(file_details)
|
return response.json(file_details)
|
||||||
|
|
||||||
@@ -1036,9 +1039,9 @@ def design():
|
|||||||
privates.sort()
|
privates.sort()
|
||||||
|
|
||||||
# Get all static files
|
# Get all static files
|
||||||
MAXNFILES = 1000
|
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*',
|
||||||
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
maxnum = MAXNFILES)
|
||||||
statics = [x.replace('\\', '/') for x in statics[:MAXNFILES]]
|
statics = [x.replace(os.path.sep, '/') for x in statics]
|
||||||
statics.sort()
|
statics.sort()
|
||||||
|
|
||||||
# Get all languages
|
# Get all languages
|
||||||
@@ -1172,8 +1175,9 @@ def plugin():
|
|||||||
privates.sort()
|
privates.sort()
|
||||||
|
|
||||||
# Get all static files
|
# Get all static files
|
||||||
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*')
|
statics = listdir(apath('%s/static/' % app, r=request), '[^\.#].*',
|
||||||
statics = [x.replace('\\', '/') for x in statics]
|
maxnum = MAXNFILES)
|
||||||
|
statics = [x.replace(os.path.sep, '/') for x in statics]
|
||||||
statics.sort()
|
statics.sort()
|
||||||
|
|
||||||
# Get all languages
|
# Get all languages
|
||||||
@@ -1324,7 +1328,8 @@ def create_file():
|
|||||||
from gluon import *\n""")[1:]
|
from gluon import *\n""")[1:]
|
||||||
|
|
||||||
elif (path[-8:] == '/static/') or (path[-9:] == '/private/'):
|
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)
|
filename = 'plugin_%s/%s' % (request.vars.plugin, filename)
|
||||||
text = ''
|
text = ''
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
def listfiles(app, dir, regexp='.*\.py$'):
|
def listfiles(app, dir, regexp='.*\.py$'):
|
||||||
files = sorted(
|
files = sorted(
|
||||||
listdir(apath('%(app)s/%(dir)s/' % {'app':app, 'dir':dir}, r=request), regexp))
|
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
|
return files
|
||||||
|
|
||||||
def editfile(path,file,vars={}):
|
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">
|
<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>
|
<li><input type="text" placeholder="{{=T('Rapid Search')}}" class="input-block-level typeahead-tw search-query"></li>
|
||||||
{{dirs=[{'name':'models', 'reg':'.*\.py$'},
|
{{dirs=[{'name':'models', 'reg':'.*\.py$'},
|
||||||
{'name':'controllers', 'reg':'.*\.py$'},
|
{'name':'controllers', 'reg':'.*\.py$'},
|
||||||
{'name':'views', 'reg':'[\w/\-]+(\.\w+)+$'},
|
{'name':'views', 'reg':'[\w/\-]+(\.\w+)+$'},
|
||||||
{'name':'modules', 'reg':'.*\.py$'},
|
{'name':'modules', 'reg':'.*\.py$'}, ]}}
|
||||||
{'name':'private', 'reg': '[^\.#].*'}]}}
|
|
||||||
{{auto_complete_list=[]}}
|
{{auto_complete_list=[]}}
|
||||||
{{for dir in dirs:}}
|
{{for dir in dirs:}}
|
||||||
<li class="nav-header component" onclick="collapse('{{="%s_files" % dir['name']}}');">{{=dir['name']}}</li>
|
<li class="nav-header component" onclick="collapse('{{="%s_files" % dir['name']}}');">{{=dir['name']}}</li>
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ def detect(agent):
|
|||||||
result['exception'] = ex
|
result['exception'] = ex
|
||||||
# hack to address https://code.google.com/p/web2py/issues/detail?id=1755
|
# hack to address https://code.google.com/p/web2py/issues/detail?id=1755
|
||||||
if not 'browser' in result:
|
if not 'browser' in result:
|
||||||
result['browser'] = Storage({'name':'IE11'})
|
result['browser'] = {'name':'IE11'}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -109,6 +109,7 @@ def listdir(
|
|||||||
drop=True,
|
drop=True,
|
||||||
add_dirs=False,
|
add_dirs=False,
|
||||||
sort=True,
|
sort=True,
|
||||||
|
maxnum = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
like os.listdir() but you can specify a regex pattern to filter files.
|
like os.listdir() but you can specify a regex pattern to filter files.
|
||||||
@@ -121,7 +122,7 @@ def listdir(
|
|||||||
else:
|
else:
|
||||||
n = 0
|
n = 0
|
||||||
regex = re.compile(expression)
|
regex = re.compile(expression)
|
||||||
items = []
|
items = []
|
||||||
for (root, dirs, files) in os.walk(path, topdown=True):
|
for (root, dirs, files) in os.walk(path, topdown=True):
|
||||||
for dir in dirs[:]:
|
for dir in dirs[:]:
|
||||||
if dir.startswith('.'):
|
if dir.startswith('.'):
|
||||||
@@ -131,6 +132,8 @@ def listdir(
|
|||||||
for file in sorted(files):
|
for file in sorted(files):
|
||||||
if regex.match(file) and not file.startswith('.'):
|
if regex.match(file) and not file.startswith('.'):
|
||||||
items.append(os.path.join(root, file)[n:])
|
items.append(os.path.join(root, file)[n:])
|
||||||
|
if maxnum and len(items)>=maxnum:
|
||||||
|
break
|
||||||
if sort:
|
if sort:
|
||||||
return sorted(items)
|
return sorted(items)
|
||||||
else:
|
else:
|
||||||
|
|||||||
+5
-5
@@ -294,14 +294,14 @@ class Request(Storage):
|
|||||||
def user_agent(self):
|
def user_agent(self):
|
||||||
from gluon.contrib import user_agent_parser
|
from gluon.contrib import user_agent_parser
|
||||||
session = current.session
|
session = current.session
|
||||||
user_agent = session._user_agent or \
|
user_agent = session._user_agent
|
||||||
user_agent_parser.detect(self.env.http_user_agent)
|
if user_agent:
|
||||||
if session:
|
return user_agent
|
||||||
session._user_agent = user_agent
|
user_agent = user_agent_parser.detect(self.env.http_user_agent)
|
||||||
user_agent = Storage(user_agent)
|
|
||||||
for key, value in user_agent.items():
|
for key, value in user_agent.items():
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
user_agent[key] = Storage(value)
|
user_agent[key] = Storage(value)
|
||||||
|
user_agent = session._user_agent = Storage(user_agent)
|
||||||
return user_agent
|
return user_agent
|
||||||
|
|
||||||
def requires_https(self):
|
def requires_https(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user