@@ -47,3 +47,4 @@ if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage']
|
||||
#set static_version
|
||||
from gluon.settings import global_settings
|
||||
response.static_version = global_settings.web2py_version.split('-')[0]
|
||||
response.static_version_urls = True
|
||||
|
||||
@@ -9,7 +9,7 @@ var current_editor = "{{=editor_settings['editor']}}"; //Default editor
|
||||
{{pass}}
|
||||
var current_font_incr = 0; // Default font-size, 0 means don't set
|
||||
</script>
|
||||
{{cm=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'codemirror')}}
|
||||
{{cm=URL('static', 'codemirror')}}
|
||||
<link rel="stylesheet" href="{{=cm}}/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="{{='%s/theme/%s.css' % (cm, editor_settings['theme'])}}">
|
||||
<script src="{{=cm}}/lib/codemirror.js"></script>
|
||||
|
||||
@@ -44,9 +44,9 @@ def file_create_form(location, anchor=None, helptext=""):
|
||||
url = URL('edit', args=args, vars=vars)
|
||||
return A(file, _class='editor_filelink', _href=url, _style='word-wrap: nowrap;')
|
||||
}}
|
||||
{{cm=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'codemirror')}}
|
||||
{{js_url=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'js')}}
|
||||
{{css_url=URL('static%s' % (response.static_version and '/_' + response.static_version or ''),'css')}}
|
||||
{{cm=URL('static', 'codemirror')}}
|
||||
{{js_url=URL('static', 'js')}}
|
||||
{{css_url=URL('static', 'css')}}
|
||||
<link rel="stylesheet" href="{{=cm}}/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="{{='%s/theme/%s.css' % (cm, editor_settings['theme'])}}">
|
||||
<script src="{{=cm}}/lib/codemirror.js"></script>
|
||||
@@ -311,8 +311,8 @@ $(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
<!-- Typeahead scripts here so the page load faster -->
|
||||
<script src="{{=URL('static%s' % (response.static_version and '/_' + response.static_version or ''), 'js/typeahead.min.js')}}"></script>
|
||||
<script src="{{=URL('static%s' % (response.static_version and '/_' + response.static_version or ''), 'js/hogan-2.0.0.js')}}"></script>
|
||||
<script src="{{=URL('static', 'js/typeahead.min.js')}}"></script>
|
||||
<script src="{{=URL('static', 'js/hogan-2.0.0.js')}}"></script>
|
||||
<script>
|
||||
$('.typeahead-tw').typeahead({
|
||||
name: 'files',
|
||||
|
||||
@@ -29,9 +29,9 @@ from gluon import recfile
|
||||
import hashlib
|
||||
import portalocker
|
||||
try:
|
||||
import cPickle as pickle
|
||||
import cPickle as pickle
|
||||
except:
|
||||
import pickle
|
||||
import pickle
|
||||
from pickle import Pickler, MARK, DICT, EMPTY_DICT
|
||||
from types import DictionaryType
|
||||
import cStringIO
|
||||
@@ -234,7 +234,8 @@ class Request(Storage):
|
||||
dpost = cgi.FieldStorage(fp=body, environ=env, keep_blank_values=1)
|
||||
try:
|
||||
post_vars.update(dpost)
|
||||
except: pass
|
||||
except:
|
||||
pass
|
||||
if query_string is not None:
|
||||
env['QUERY_STRING'] = query_string
|
||||
# The same detection used by FieldStorage to detect multipart POSTs
|
||||
@@ -332,8 +333,8 @@ class Request(Storage):
|
||||
and secures the session.
|
||||
"""
|
||||
cmd_opts = global_settings.cmd_options
|
||||
#checking if this is called within the scheduler or within the shell
|
||||
#in addition to checking if it's not a cronjob
|
||||
# checking if this is called within the scheduler or within the shell
|
||||
# in addition to checking if it's not a cronjob
|
||||
if ((cmd_opts and (cmd_opts.shell or cmd_opts.scheduler))
|
||||
or global_settings.cronjob or self.is_https):
|
||||
current.session.secure()
|
||||
@@ -394,7 +395,7 @@ class Response(Storage):
|
||||
self._custom_commit = None
|
||||
self._custom_rollback = None
|
||||
self.generic_patterns = ['*']
|
||||
self.delimiters = ('{{','}}')
|
||||
self.delimiters = ('{{', '}}')
|
||||
self.formstyle = 'table3cols'
|
||||
self.form_label_separator = ': '
|
||||
|
||||
@@ -490,7 +491,11 @@ class Response(Storage):
|
||||
for item in files:
|
||||
if isinstance(item, str):
|
||||
f = item.lower().split('?')[0]
|
||||
if self.static_version:
|
||||
# if static_version we need also to check for
|
||||
# static_version_urls. In that case, the _.x.x.x
|
||||
# bit would have already been added by the URL()
|
||||
# function
|
||||
if self.static_version and not self.static_version_urls:
|
||||
item = item.replace(
|
||||
'/static/', '/static/_%s/' % self.static_version, 1)
|
||||
if f.endswith('.css'):
|
||||
@@ -698,7 +703,7 @@ class Response(Storage):
|
||||
DIV(BEAUTIFY(current.response), backtotop,
|
||||
_class="w2p-toolbar-hidden", _id="response-%s" % u),
|
||||
DIV(BEAUTIFY(dbtables), backtotop,
|
||||
_class="w2p-toolbar-hidden",_id="db-tables-%s" % u),
|
||||
_class="w2p-toolbar-hidden", _id="db-tables-%s" % u),
|
||||
DIV(BEAUTIFY(dbstats), backtotop,
|
||||
_class="w2p-toolbar-hidden", _id="db-stats-%s" % u),
|
||||
SCRIPT("jQuery('.w2p-toolbar-hidden').hide()"),
|
||||
@@ -1007,7 +1012,7 @@ class Session(Storage):
|
||||
elif self._secure and response.session_id_name in rcookies:
|
||||
rcookies[response.session_id_name]['secure'] = True
|
||||
|
||||
def clear_session_cookies(sefl):
|
||||
def clear_session_cookies(self):
|
||||
request = current.request
|
||||
response = current.response
|
||||
session = response.session
|
||||
@@ -1189,6 +1194,7 @@ class Session(Storage):
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def pickle_session(s):
|
||||
return Session, (dict(s),)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user