Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
961d143f7d | ||
|
|
0e98544a79 | ||
|
|
86d8b8dece | ||
|
|
46e2a663e9 | ||
|
|
e7fbd0095f | ||
|
|
add6fa526e | ||
|
|
47e77e9a9c | ||
|
|
81036ac997 | ||
|
|
77df883566 | ||
|
|
bfc7e3b4e9 | ||
|
|
e05fe15470 | ||
|
|
2a062a2ff5 | ||
|
|
44e7b70dbc | ||
|
|
88abefb896 | ||
|
|
06ca5e6857 | ||
|
|
c1f8d34892 | ||
|
|
5679661914 | ||
|
|
cd957cf52b | ||
|
|
fff798c1cc | ||
|
|
b464d3185e | ||
|
|
cfb68ff90f |
@@ -55,3 +55,4 @@ applications/admin/cron/cron.master
|
|||||||
HOWTO-web2py-devel
|
HOWTO-web2py-devel
|
||||||
*.sublime-project
|
*.sublime-project
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
.idea/*
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## 2.7.1
|
## 2.7.1 - 2.7.2
|
||||||
|
|
||||||
- jQuery 1.10.2
|
- jQuery 1.10.2
|
||||||
- codemirror 3.18, thanks Paolo
|
- codemirror 3.18, thanks Paolo
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ update:
|
|||||||
echo "remember that pymysql was tweaked"
|
echo "remember that pymysql was tweaked"
|
||||||
src:
|
src:
|
||||||
### Use semantic versioning
|
### Use semantic versioning
|
||||||
echo 'Version 2.7.1-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
echo 'Version 2.7.2-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||||
### rm -f all junk files
|
### rm -f all junk files
|
||||||
make clean
|
make clean
|
||||||
### clean up baisc apps
|
### clean up baisc apps
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Version 2.7.1-stable+timestamp.2013.10.04.15.14.09
|
Version 2.7.2-stable+timestamp.2013.10.07.08.39.32
|
||||||
|
|||||||
+34
-26
@@ -33,7 +33,7 @@ class Servers:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def wsgiref(app, address, **options): # pragma: no cover
|
def wsgiref(app, address, **options): # pragma: no cover
|
||||||
from wsgiref.simple_server import make_server, WSGIRequestHandler
|
from wsgiref.simple_server import make_server, WSGIRequestHandler
|
||||||
|
options = {}
|
||||||
class QuietHandler(WSGIRequestHandler):
|
class QuietHandler(WSGIRequestHandler):
|
||||||
def log_request(*args, **kw):
|
def log_request(*args, **kw):
|
||||||
pass
|
pass
|
||||||
@@ -71,6 +71,7 @@ class Servers:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def paste(app, address, **options):
|
def paste(app, address, **options):
|
||||||
|
options = {}
|
||||||
from paste import httpserver
|
from paste import httpserver
|
||||||
from paste.translogger import TransLogger
|
from paste.translogger import TransLogger
|
||||||
httpserver.serve(app, host=address[0], port=address[1], **options)
|
httpserver.serve(app, host=address[0], port=address[1], **options)
|
||||||
@@ -90,10 +91,12 @@ class Servers:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def gevent(app, address, **options):
|
def gevent(app, address, **options):
|
||||||
|
options = options['options']
|
||||||
|
workers = options.workers
|
||||||
from gevent import pywsgi
|
from gevent import pywsgi
|
||||||
from gevent.pool import Pool
|
from gevent.pool import Pool
|
||||||
pywsgi.WSGIServer(address, app, spawn='workers' in options and Pool(
|
pywsgi.WSGIServer(address, app, spawn=workers and Pool(
|
||||||
int(options.workers)) or 'default').serve_forever()
|
int(options.workers)) or 'default', log=None).serve_forever()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def bjoern(app, address, **options):
|
def bjoern(app, address, **options):
|
||||||
@@ -130,6 +133,7 @@ class Servers:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def gunicorn(app, address, **options):
|
def gunicorn(app, address, **options):
|
||||||
|
options = {}
|
||||||
from gunicorn.app.base import Application
|
from gunicorn.app.base import Application
|
||||||
config = {'bind': "%s:%d" % address}
|
config = {'bind': "%s:%d" % address}
|
||||||
config.update(options)
|
config.update(options)
|
||||||
@@ -176,27 +180,6 @@ class Servers:
|
|||||||
s = wsgi.WSGIServer(callable=app, bind="%s:%d" % address)
|
s = wsgi.WSGIServer(callable=app, bind="%s:%d" % address)
|
||||||
s.start()
|
s.start()
|
||||||
|
|
||||||
def run(servername, ip, port, softcron=True, logging=False, profiler=None):
|
|
||||||
if servername == 'gevent':
|
|
||||||
from gevent import monkey
|
|
||||||
monkey.patch_all()
|
|
||||||
elif servername == 'eventlet':
|
|
||||||
import eventlet
|
|
||||||
eventlet.monkey_patch()
|
|
||||||
|
|
||||||
import gluon.main
|
|
||||||
|
|
||||||
if logging:
|
|
||||||
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
|
|
||||||
logfilename='httpserver.log',
|
|
||||||
profiler_dir=profiler)
|
|
||||||
else:
|
|
||||||
application = gluon.main.wsgibase
|
|
||||||
if softcron:
|
|
||||||
from gluon.settings import global_settings
|
|
||||||
global_settings.web2py_crontype = 'soft'
|
|
||||||
getattr(Servers, servername)(application, (ip, int(port)))
|
|
||||||
|
|
||||||
|
|
||||||
def mongrel2_handler(application, conn, debug=False):
|
def mongrel2_handler(application, conn, debug=False):
|
||||||
"""
|
"""
|
||||||
@@ -303,6 +286,30 @@ def mongrel2_handler(application, conn, debug=False):
|
|||||||
req, data, code=code, status=status, headers=headers)
|
req, data, code=code, status=status, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
def run(servername, ip, port, softcron=True, logging=False, profiler=None,
|
||||||
|
options=None):
|
||||||
|
if servername == 'gevent':
|
||||||
|
from gevent import monkey
|
||||||
|
monkey.patch_all()
|
||||||
|
elif servername == 'eventlet':
|
||||||
|
import eventlet
|
||||||
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
|
import gluon.main
|
||||||
|
|
||||||
|
if logging:
|
||||||
|
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
|
||||||
|
logfilename='httpserver.log',
|
||||||
|
profiler_dir=profiler)
|
||||||
|
else:
|
||||||
|
application = gluon.main.wsgibase
|
||||||
|
if softcron:
|
||||||
|
from gluon.settings import global_settings
|
||||||
|
global_settings.web2py_crontype = 'soft'
|
||||||
|
getattr(Servers, servername)(application, (ip, int(port)), options=options)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P"
|
usage = "python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P"
|
||||||
try:
|
try:
|
||||||
@@ -339,14 +346,15 @@ def main():
|
|||||||
help='port number')
|
help='port number')
|
||||||
parser.add_option('-w',
|
parser.add_option('-w',
|
||||||
'--workers',
|
'--workers',
|
||||||
default='',
|
default=None,
|
||||||
dest='workers',
|
dest='workers',
|
||||||
help='number of workers number')
|
help='number of workers number')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
print 'starting %s on %s:%s...' % (
|
print 'starting %s on %s:%s...' % (
|
||||||
options.server, options.ip, options.port)
|
options.server, options.ip, options.port)
|
||||||
run(options.server, options.ip, options.port,
|
run(options.server, options.ip, options.port,
|
||||||
logging=options.logging, profiler=options.profiler_dir)
|
logging=options.logging, profiler=options.profiler_dir,
|
||||||
|
options=options)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||||
'(something like "it-it")': '(algo como "it-it")',
|
'(something like "it-it")': '(algo como "it-it")',
|
||||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||||
|
'@markmin\x01An error occured, please [[reload %s]] the page': 'An error occured, please [[reload %s]] the page',
|
||||||
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
||||||
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
||||||
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
'appadmin': 'appadmin',
|
'appadmin': 'appadmin',
|
||||||
'appadmin is disabled because insecure channel': 'admin deshabilitado, el canal no es seguro',
|
'appadmin is disabled because insecure channel': 'admin deshabilitado, el canal no es seguro',
|
||||||
'application "%s" uninstalled': 'aplicación "%s" desinstalada',
|
'application "%s" uninstalled': 'aplicación "%s" desinstalada',
|
||||||
|
'application %(appname)s installed with md5sum: %(digest)s': 'application %(appname)s installed with md5sum: %(digest)s',
|
||||||
'application compiled': 'aplicación compilada',
|
'application compiled': 'aplicación compilada',
|
||||||
'application is compiled and cannot be designed': 'la aplicación está compilada y no puede ser modificada',
|
'application is compiled and cannot be designed': 'la aplicación está compilada y no puede ser modificada',
|
||||||
'Application name:': 'Application name:',
|
'Application name:': 'Application name:',
|
||||||
@@ -92,6 +94,7 @@
|
|||||||
'Create new application using the Wizard': 'Create new application using the Wizard',
|
'Create new application using the Wizard': 'Create new application using the Wizard',
|
||||||
'create new application:': 'nombre de la nueva aplicación:',
|
'create new application:': 'nombre de la nueva aplicación:',
|
||||||
'Create new simple application': 'Cree una nueva aplicación',
|
'Create new simple application': 'Cree una nueva aplicación',
|
||||||
|
'Create/Upload': 'Create/Upload',
|
||||||
'created by': 'creado por',
|
'created by': 'creado por',
|
||||||
'crontab': 'crontab',
|
'crontab': 'crontab',
|
||||||
'Current request': 'Solicitud en curso',
|
'Current request': 'Solicitud en curso',
|
||||||
|
|||||||
@@ -264,16 +264,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
trap_link: function (target) {
|
|
||||||
$('#' + target + ' a.w2p_trap').each(function (i) {
|
|
||||||
var link = $(this);
|
|
||||||
link.click(function (e) {
|
|
||||||
web2py.hide_flash();
|
|
||||||
web2py.ajax_page('get', link.attr('href'), [], target, $(this));
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
ajax_page: function (method, action, data, target, element) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
if(element == undefined) element = $(document);
|
if(element == undefined) element = $(document);
|
||||||
@@ -307,7 +297,6 @@
|
|||||||
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
||||||
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
||||||
web2py.trap_form(action, target);
|
web2py.trap_form(action, target);
|
||||||
web2py.trap_link(target);
|
|
||||||
web2py.ajax_init('#' + target);
|
web2py.ajax_init('#' + target);
|
||||||
web2py.after_ajax(xhr);
|
web2py.after_ajax(xhr);
|
||||||
}
|
}
|
||||||
@@ -692,10 +681,8 @@ collapse = jQuery.web2py.collapse;
|
|||||||
fade = jQuery.web2py.fade;
|
fade = jQuery.web2py.fade;
|
||||||
|
|
||||||
/* internals - shouldn't be needed
|
/* internals - shouldn't be needed
|
||||||
|
|
||||||
web2py_ajax_init = jQuery.web2py.ajax_init;
|
web2py_ajax_init = jQuery.web2py.ajax_init;
|
||||||
web2py_event_handlers = jQuery.web2py.event_handlers;
|
web2py_event_handlers = jQuery.web2py.event_handlers;
|
||||||
|
|
||||||
web2py_trap_link = jQuery.web2py.trap_link;
|
web2py_trap_link = jQuery.web2py.trap_link;
|
||||||
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -264,16 +264,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
trap_link: function (target) {
|
|
||||||
$('#' + target + ' a.w2p_trap').each(function (i) {
|
|
||||||
var link = $(this);
|
|
||||||
link.click(function (e) {
|
|
||||||
web2py.hide_flash();
|
|
||||||
web2py.ajax_page('get', link.attr('href'), [], target, $(this));
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
ajax_page: function (method, action, data, target, element) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
if(element == undefined) element = $(document);
|
if(element == undefined) element = $(document);
|
||||||
@@ -307,7 +297,6 @@
|
|||||||
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
||||||
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
||||||
web2py.trap_form(action, target);
|
web2py.trap_form(action, target);
|
||||||
web2py.trap_link(target);
|
|
||||||
web2py.ajax_init('#' + target);
|
web2py.ajax_init('#' + target);
|
||||||
web2py.after_ajax(xhr);
|
web2py.after_ajax(xhr);
|
||||||
}
|
}
|
||||||
@@ -692,10 +681,8 @@ collapse = jQuery.web2py.collapse;
|
|||||||
fade = jQuery.web2py.fade;
|
fade = jQuery.web2py.fade;
|
||||||
|
|
||||||
/* internals - shouldn't be needed
|
/* internals - shouldn't be needed
|
||||||
|
|
||||||
web2py_ajax_init = jQuery.web2py.ajax_init;
|
web2py_ajax_init = jQuery.web2py.ajax_init;
|
||||||
web2py_event_handlers = jQuery.web2py.event_handlers;
|
web2py_event_handlers = jQuery.web2py.event_handlers;
|
||||||
|
|
||||||
web2py_trap_link = jQuery.web2py.trap_link;
|
web2py_trap_link = jQuery.web2py.trap_link;
|
||||||
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -264,16 +264,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
trap_link: function (target) {
|
|
||||||
$('#' + target + ' a.w2p_trap').each(function (i) {
|
|
||||||
var link = $(this);
|
|
||||||
link.click(function (e) {
|
|
||||||
web2py.hide_flash();
|
|
||||||
web2py.ajax_page('get', link.attr('href'), [], target, $(this));
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
ajax_page: function (method, action, data, target, element) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
if(element == undefined) element = $(document);
|
if(element == undefined) element = $(document);
|
||||||
@@ -307,7 +297,6 @@
|
|||||||
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
web2py.fire(element, 'ajax:complete', [xhr, status], target);
|
||||||
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
web2py.updatePage(xhr, target); /* Parse and load the html received */
|
||||||
web2py.trap_form(action, target);
|
web2py.trap_form(action, target);
|
||||||
web2py.trap_link(target);
|
|
||||||
web2py.ajax_init('#' + target);
|
web2py.ajax_init('#' + target);
|
||||||
web2py.after_ajax(xhr);
|
web2py.after_ajax(xhr);
|
||||||
}
|
}
|
||||||
@@ -692,10 +681,8 @@ collapse = jQuery.web2py.collapse;
|
|||||||
fade = jQuery.web2py.fade;
|
fade = jQuery.web2py.fade;
|
||||||
|
|
||||||
/* internals - shouldn't be needed
|
/* internals - shouldn't be needed
|
||||||
|
|
||||||
web2py_ajax_init = jQuery.web2py.ajax_init;
|
web2py_ajax_init = jQuery.web2py.ajax_init;
|
||||||
web2py_event_handlers = jQuery.web2py.event_handlers;
|
web2py_event_handlers = jQuery.web2py.event_handlers;
|
||||||
|
|
||||||
web2py_trap_link = jQuery.web2py.trap_link;
|
web2py_trap_link = jQuery.web2py.trap_link;
|
||||||
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
web2py_calc_entropy = jQuery.web2py.calc_entropy;
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-6
@@ -353,7 +353,7 @@ def plugin_install(app, fobj, request, filename):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check_new_version(myversion, version_URL):
|
def check_new_version(myversion, version_url):
|
||||||
"""
|
"""
|
||||||
Compares current web2py's version with the latest stable web2py version.
|
Compares current web2py's version with the latest stable web2py version.
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ def check_new_version(myversion, version_URL):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from urllib import urlopen
|
from urllib import urlopen
|
||||||
version = urlopen(version_URL).read()
|
version = urlopen(version_url).read()
|
||||||
pversion = parse_version(version)
|
pversion = parse_version(version)
|
||||||
pmyversion = parse_version(myversion)
|
pmyversion = parse_version(myversion)
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -398,7 +398,7 @@ def unzip(filename, dir, subfolder=''):
|
|||||||
raise RuntimeError('Not a valid zipfile')
|
raise RuntimeError('Not a valid zipfile')
|
||||||
zf = zipfile.ZipFile(filename)
|
zf = zipfile.ZipFile(filename)
|
||||||
if not subfolder.endswith('/'):
|
if not subfolder.endswith('/'):
|
||||||
subfolder = subfolder + '/'
|
subfolder += '/'
|
||||||
n = len(subfolder)
|
n = len(subfolder)
|
||||||
for name in sorted(zf.namelist()):
|
for name in sorted(zf.namelist()):
|
||||||
if not name.startswith(subfolder):
|
if not name.startswith(subfolder):
|
||||||
@@ -432,11 +432,11 @@ def upgrade(request, url='http://web2py.com'):
|
|||||||
web2py_version = request.env.web2py_version
|
web2py_version = request.env.web2py_version
|
||||||
gluon_parent = request.env.gluon_parent
|
gluon_parent = request.env.gluon_parent
|
||||||
if not gluon_parent.endswith('/'):
|
if not gluon_parent.endswith('/'):
|
||||||
gluon_parent = gluon_parent + '/'
|
gluon_parent += '/'
|
||||||
(check, version) = check_new_version(web2py_version,
|
(check, version) = check_new_version(web2py_version,
|
||||||
url + '/examples/default/version')
|
url + '/examples/default/version')
|
||||||
if not check:
|
if not check:
|
||||||
return (False, 'Already latest version')
|
return False, 'Already latest version'
|
||||||
if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')):
|
if os.path.exists(os.path.join(gluon_parent, 'web2py.exe')):
|
||||||
version_type = 'win'
|
version_type = 'win'
|
||||||
destination = gluon_parent
|
destination = gluon_parent
|
||||||
@@ -452,7 +452,6 @@ def upgrade(request, url='http://web2py.com'):
|
|||||||
|
|
||||||
full_url = url + '/examples/static/web2py_%s.zip' % version_type
|
full_url = url + '/examples/static/web2py_%s.zip' % version_type
|
||||||
filename = abspath('web2py_%s_downloaded.zip' % version_type)
|
filename = abspath('web2py_%s_downloaded.zip' % version_type)
|
||||||
file = None
|
|
||||||
try:
|
try:
|
||||||
write_file(filename, urllib.urlopen(full_url).read(), 'wb')
|
write_file(filename, urllib.urlopen(full_url).read(), 'wb')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
+1
-3
@@ -19,7 +19,6 @@ When web2py is running on Google App Engine,
|
|||||||
caching will be provided by the GAE memcache
|
caching will be provided by the GAE memcache
|
||||||
(see gluon.contrib.gae_memcache)
|
(see gluon.contrib.gae_memcache)
|
||||||
"""
|
"""
|
||||||
import traceback
|
|
||||||
import time
|
import time
|
||||||
import portalocker
|
import portalocker
|
||||||
import shelve
|
import shelve
|
||||||
@@ -278,7 +277,7 @@ class CacheOnDisk(CacheAbstract):
|
|||||||
storage = shelve.open(self.shelve_name)
|
storage = shelve.open(self.shelve_name)
|
||||||
except:
|
except:
|
||||||
logger.error('corrupted cache file %s, will try rebuild it'
|
logger.error('corrupted cache file %s, will try rebuild it'
|
||||||
% (self.shelve_name))
|
% self.shelve_name)
|
||||||
storage = None
|
storage = None
|
||||||
if not storage and os.path.exists(self.shelve_name):
|
if not storage and os.path.exists(self.shelve_name):
|
||||||
os.unlink(self.shelve_name)
|
os.unlink(self.shelve_name)
|
||||||
@@ -479,7 +478,6 @@ class Cache(object):
|
|||||||
if not session_ and public_:
|
if not session_ and public_:
|
||||||
cache_control += ', public'
|
cache_control += ', public'
|
||||||
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT')
|
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||||
vary = None
|
|
||||||
else:
|
else:
|
||||||
cache_control += ', private'
|
cache_control += ', private'
|
||||||
expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
|
expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
|
||||||
|
|||||||
@@ -641,9 +641,9 @@ def ldap_auth(server='ldap', port=None,
|
|||||||
# bind as anonymous
|
# bind as anonymous
|
||||||
con.simple_bind_s('', '')
|
con.simple_bind_s('', '')
|
||||||
|
|
||||||
# if username is None, return empty list
|
# if username is None, return empty list
|
||||||
if username is None:
|
if username is None:
|
||||||
return list()
|
return list()
|
||||||
# search for groups where user is in
|
# search for groups where user is in
|
||||||
filter = '(&(%s=%s)(%s))' % (ldap.filter.escape_filter_chars(
|
filter = '(&(%s=%s)(%s))' % (ldap.filter.escape_filter_chars(
|
||||||
group_member_attrib
|
group_member_attrib
|
||||||
|
|||||||
+15
-7
@@ -6124,7 +6124,7 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
else:
|
else:
|
||||||
return (uid_list[0], uid_list[-1])
|
return (uid_list[0], uid_list[-1])
|
||||||
|
|
||||||
def convert_date(self, date, add=None):
|
def convert_date(self, date, add=None, imf=False):
|
||||||
if add is None:
|
if add is None:
|
||||||
add = datetime.timedelta()
|
add = datetime.timedelta()
|
||||||
""" Convert a date object to a string
|
""" Convert a date object to a string
|
||||||
@@ -6138,7 +6138,10 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
if isinstance(date, basestring):
|
if isinstance(date, basestring):
|
||||||
# Prevent unexpected date response format
|
# Prevent unexpected date response format
|
||||||
try:
|
try:
|
||||||
dayname, datestring = date.split(",")
|
if "," in date:
|
||||||
|
dayname, datestring = date.split(",")
|
||||||
|
else:
|
||||||
|
dayname, datestring = None, date
|
||||||
date_list = datestring.strip().split()
|
date_list = datestring.strip().split()
|
||||||
year = int(date_list[2])
|
year = int(date_list[2])
|
||||||
month = months.index(date_list[1].upper())
|
month = months.index(date_list[1].upper())
|
||||||
@@ -6150,8 +6153,10 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
LOGGER.error("Could not parse date text: %s. %s" %
|
LOGGER.error("Could not parse date text: %s. %s" %
|
||||||
(date, e))
|
(date, e))
|
||||||
return None
|
return None
|
||||||
elif isinstance(date, (datetime.datetime, datetime.date)):
|
elif isinstance(date, (datetime.date, datetime.datetime)):
|
||||||
return (date + add).strftime("%d-%b-%Y")
|
if imf: date_format = "%a, %d %b %Y %H:%M:%S %z"
|
||||||
|
else: date_format = "%d-%b-%Y"
|
||||||
|
return (date + add).strftime(date_format)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -6532,7 +6537,8 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
|
|
||||||
mailbox = table.mailbox
|
mailbox = table.mailbox
|
||||||
d = dict(((k.name, v) for k, v in fields))
|
d = dict(((k.name, v) for k, v in fields))
|
||||||
date_time = (d.get("created", datetime.datetime.now())).timetuple()
|
date_time = d.get("created", datetime.datetime.now())
|
||||||
|
struct_time = date_time.timetuple()
|
||||||
if len(d) > 0:
|
if len(d) > 0:
|
||||||
message = d.get("email", None)
|
message = d.get("email", None)
|
||||||
attachments = d.get("attachments", [])
|
attachments = d.get("attachments", [])
|
||||||
@@ -6547,6 +6553,8 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
message = Message()
|
message = Message()
|
||||||
message["from"] = d.get("sender", "")
|
message["from"] = d.get("sender", "")
|
||||||
message["subject"] = d.get("subject", "")
|
message["subject"] = d.get("subject", "")
|
||||||
|
message["date"] = self.convert_date(date_time, imf=True)
|
||||||
|
|
||||||
if mime:
|
if mime:
|
||||||
message.set_type(mime)
|
message.set_type(mime)
|
||||||
if charset:
|
if charset:
|
||||||
@@ -6569,7 +6577,7 @@ class IMAPAdapter(NoSQLAdapter):
|
|||||||
[add_payload(message, c) for c in content]
|
[add_payload(message, c) for c in content]
|
||||||
[add_payload(message, a) for a in attachments]
|
[add_payload(message, a) for a in attachments]
|
||||||
message = message.as_string()
|
message = message.as_string()
|
||||||
return (mailbox, flags, date_time, message)
|
return (mailbox, flags, struct_time, message)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("IMAP empty insert is not implemented")
|
raise NotImplementedError("IMAP empty insert is not implemented")
|
||||||
|
|
||||||
@@ -10501,7 +10509,7 @@ class Rows(object):
|
|||||||
|
|
||||||
|
|
||||||
if i is None:
|
if i is None:
|
||||||
return (self.repr(i, fields=fields) for i in range(len(self)))
|
return (self.render(i, fields=fields) for i in range(len(self)))
|
||||||
import sqlhtml
|
import sqlhtml
|
||||||
row = copy.deepcopy(self.records[i])
|
row = copy.deepcopy(self.records[i])
|
||||||
keys = row.keys()
|
keys = row.keys()
|
||||||
|
|||||||
+2
-2
@@ -44,6 +44,7 @@ defined_status = {
|
|||||||
416: 'REQUESTED RANGE NOT SATISFIABLE',
|
416: 'REQUESTED RANGE NOT SATISFIABLE',
|
||||||
417: 'EXPECTATION FAILED',
|
417: 'EXPECTATION FAILED',
|
||||||
422: 'UNPROCESSABLE ENTITY',
|
422: 'UNPROCESSABLE ENTITY',
|
||||||
|
429: 'TOO MANY REQUESTS',
|
||||||
451: 'UNAVAILABLE FOR LEGAL REASONS', # http://www.451unavailable.org/
|
451: 'UNAVAILABLE FOR LEGAL REASONS', # http://www.451unavailable.org/
|
||||||
500: 'INTERNAL SERVER ERROR',
|
500: 'INTERNAL SERVER ERROR',
|
||||||
501: 'NOT IMPLEMENTED',
|
501: 'NOT IMPLEMENTED',
|
||||||
@@ -53,8 +54,7 @@ defined_status = {
|
|||||||
505: 'HTTP VERSION NOT SUPPORTED',
|
505: 'HTTP VERSION NOT SUPPORTED',
|
||||||
}
|
}
|
||||||
|
|
||||||
regex_status = re.compile('^\d{3} \w+$')
|
regex_status = re.compile('^\d{3} [0-9A-Z ]+$')
|
||||||
|
|
||||||
|
|
||||||
class HTTP(Exception):
|
class HTTP(Exception):
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -288,7 +288,10 @@ def run(
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
import IPython
|
import IPython
|
||||||
if IPython.__version__ >= '0.11':
|
if IPython.__version__ >= '1.0':
|
||||||
|
IPython.start_ipython(user_ns=_env)
|
||||||
|
return
|
||||||
|
elif IPython.__version__ >= '0.11':
|
||||||
from IPython.frontend.terminal.embed import InteractiveShellEmbed
|
from IPython.frontend.terminal.embed import InteractiveShellEmbed
|
||||||
shell = InteractiveShellEmbed(user_ns=_env)
|
shell = InteractiveShellEmbed(user_ns=_env)
|
||||||
shell()
|
shell()
|
||||||
|
|||||||
+30
-19
@@ -45,11 +45,6 @@ except ImportError:
|
|||||||
table_field = re.compile('[\w_]+\.[\w_]+')
|
table_field = re.compile('[\w_]+\.[\w_]+')
|
||||||
widget_class = re.compile('^\w*')
|
widget_class = re.compile('^\w*')
|
||||||
|
|
||||||
|
|
||||||
def trap_class(_class=None, trap=True):
|
|
||||||
return (trap and 'w2p_trap' or '') + (_class and ' ' + _class or '')
|
|
||||||
|
|
||||||
|
|
||||||
def represent(field, value, record):
|
def represent(field, value, record):
|
||||||
f = field.represent
|
f = field.represent
|
||||||
if not callable(f):
|
if not callable(f):
|
||||||
@@ -1897,7 +1892,8 @@ class SQLFORM(FORM):
|
|||||||
callback=callback,
|
callback=callback,
|
||||||
delete=delete,
|
delete=delete,
|
||||||
noconfirm=noconfirm,
|
noconfirm=noconfirm,
|
||||||
_class=trap_class(ui.get('button'), trap))
|
_class=ui.get('button'),
|
||||||
|
cid=request.cid)
|
||||||
else:
|
else:
|
||||||
return A(SPAN(_class=ui.get(buttonclass)),
|
return A(SPAN(_class=ui.get(buttonclass)),
|
||||||
_href=buttonurl,
|
_href=buttonurl,
|
||||||
@@ -1905,7 +1901,8 @@ class SQLFORM(FORM):
|
|||||||
delete=delete,
|
delete=delete,
|
||||||
noconfirm=noconfirm,
|
noconfirm=noconfirm,
|
||||||
_title=T(buttontext),
|
_title=T(buttontext),
|
||||||
_class=trap_class(ui.get('buttontext'), trap))
|
_class=ui.get('buttontext'),
|
||||||
|
cid=request.cid)
|
||||||
|
|
||||||
dbset = db(query,ignore_common_filters=ignore_common_filters)
|
dbset = db(query,ignore_common_filters=ignore_common_filters)
|
||||||
tablenames = db._adapter.tables(dbset.query)
|
tablenames = db._adapter.tables(dbset.query)
|
||||||
@@ -2057,7 +2054,22 @@ class SQLFORM(FORM):
|
|||||||
if ondelete:
|
if ondelete:
|
||||||
ondelete(table, request.args[-1])
|
ondelete(table, request.args[-1])
|
||||||
record.delete_record()
|
record.delete_record()
|
||||||
redirect(referrer, client_side=client_side_delete)
|
if request.ajax:
|
||||||
|
#this means javascript is enabled, so we don't need to do
|
||||||
|
#a redirect
|
||||||
|
if not client_side_delete:
|
||||||
|
#if it's an ajax request and we don't need to reload the
|
||||||
|
#entire page, let's just inform that there have been no
|
||||||
|
#exceptions and don't regenerate the grid
|
||||||
|
raise HTTP(200)
|
||||||
|
else:
|
||||||
|
#if it's requested that the grid gets reloaded on delete
|
||||||
|
#on ajax, the redirect should be on the original location
|
||||||
|
newloc = request.env.http_web2py_component_location
|
||||||
|
redirect(newloc, client_side=client_side_delete)
|
||||||
|
else:
|
||||||
|
#we need to do a redirect because javascript is not enabled
|
||||||
|
redirect(referrer, client_side=client_side_delete)
|
||||||
|
|
||||||
exportManager = dict(
|
exportManager = dict(
|
||||||
csv_with_hidden_cols=(ExporterCSV, 'CSV (hidden cols)'),
|
csv_with_hidden_cols=(ExporterCSV, 'CSV (hidden cols)'),
|
||||||
@@ -2221,7 +2233,7 @@ class SQLFORM(FORM):
|
|||||||
marker = sorter_icons[1]
|
marker = sorter_icons[1]
|
||||||
header = A(header, marker, _href=url(vars=dict(
|
header = A(header, marker, _href=url(vars=dict(
|
||||||
keywords=request.vars.keywords or '',
|
keywords=request.vars.keywords or '',
|
||||||
order=key)), _class=trap_class())
|
order=key)), cid=request.cid)
|
||||||
headcols.append(TH(header, _class=ui.get('default')))
|
headcols.append(TH(header, _class=ui.get('default')))
|
||||||
|
|
||||||
toadd = []
|
toadd = []
|
||||||
@@ -2269,7 +2281,6 @@ class SQLFORM(FORM):
|
|||||||
cacheable=True,*table_fields)
|
cacheable=True,*table_fields)
|
||||||
next_cursor = dbset._db.get('_lastcursor', None)
|
next_cursor = dbset._db.get('_lastcursor', None)
|
||||||
else:
|
else:
|
||||||
# print('table_fields: %s' %([f_.name for f_ in table_fields],))
|
|
||||||
rows = dbset.select(left=left,orderby=orderby,
|
rows = dbset.select(left=left,orderby=orderby,
|
||||||
groupby=groupby,limitby=limitby,
|
groupby=groupby,limitby=limitby,
|
||||||
cacheable=True,*table_fields)
|
cacheable=True,*table_fields)
|
||||||
@@ -2303,7 +2314,7 @@ class SQLFORM(FORM):
|
|||||||
if order: d['order']=order
|
if order: d['order']=order
|
||||||
if request.vars.keywords: d['keywords']=request.vars.keywords
|
if request.vars.keywords: d['keywords']=request.vars.keywords
|
||||||
paginator.append(LI(
|
paginator.append(LI(
|
||||||
A('next',_href=url(vars=d),_class=trap_class())))
|
A('next',_href=url(vars=d),cid=request.cid)))
|
||||||
elif paginate and paginate<nrows:
|
elif paginate and paginate<nrows:
|
||||||
npages, reminder = divmod(nrows, paginate)
|
npages, reminder = divmod(nrows, paginate)
|
||||||
if reminder:
|
if reminder:
|
||||||
@@ -2319,7 +2330,7 @@ class SQLFORM(FORM):
|
|||||||
d['order'] = order
|
d['order'] = order
|
||||||
if request.vars.keywords:
|
if request.vars.keywords:
|
||||||
d['keywords'] = request.vars.keywords
|
d['keywords'] = request.vars.keywords
|
||||||
return A(name, _href=url(vars=d), _class=trap_class())
|
return A(name, _href=url(vars=d), cid=request.cid)
|
||||||
NPAGES = 5 # window is 2*NPAGES
|
NPAGES = 5 # window is 2*NPAGES
|
||||||
if page > NPAGES + 1:
|
if page > NPAGES + 1:
|
||||||
paginator.append(LI(self_link('<<', 0)))
|
paginator.append(LI(self_link('<<', 0)))
|
||||||
@@ -2329,7 +2340,7 @@ class SQLFORM(FORM):
|
|||||||
for p in pages:
|
for p in pages:
|
||||||
if p == page:
|
if p == page:
|
||||||
paginator.append(LI(A(p + 1, _onclick='return false'),
|
paginator.append(LI(A(p + 1, _onclick='return false'),
|
||||||
_class=trap_class('current')))
|
_class='current'))
|
||||||
else:
|
else:
|
||||||
paginator.append(LI(self_link(p + 1, p)))
|
paginator.append(LI(self_link(p + 1, p)))
|
||||||
if page < npages - NPAGES:
|
if page < npages - NPAGES:
|
||||||
@@ -2598,13 +2609,13 @@ class SQLFORM(FORM):
|
|||||||
name = format(db[referee],record)
|
name = format(db[referee],record)
|
||||||
breadcrumbs.append(
|
breadcrumbs.append(
|
||||||
LI(A(T(db[referee]._plural),
|
LI(A(T(db[referee]._plural),
|
||||||
_class=trap_class(),
|
cid=request.cid,
|
||||||
_href=url()),
|
_href=url()),
|
||||||
SPAN(divider, _class='divider'),
|
SPAN(divider, _class='divider'),
|
||||||
_class='w2p_grid_breadcrumb_elem'))
|
_class='w2p_grid_breadcrumb_elem'))
|
||||||
if kwargs.get('details', True):
|
if kwargs.get('details', True):
|
||||||
breadcrumbs.append(
|
breadcrumbs.append(
|
||||||
LI(A(name, _class=trap_class(),
|
LI(A(name, cid=request.cid,
|
||||||
_href=url(args=['view', referee, id])),
|
_href=url(args=['view', referee, id])),
|
||||||
SPAN(divider, _class='divider'),
|
SPAN(divider, _class='divider'),
|
||||||
_class='w2p_grid_breadcrumb_elem'))
|
_class='w2p_grid_breadcrumb_elem'))
|
||||||
@@ -2617,7 +2628,7 @@ class SQLFORM(FORM):
|
|||||||
# if isinstance(linked_tables, dict):
|
# if isinstance(linked_tables, dict):
|
||||||
# linked_tables = linked_tables.get(table._tablename, [])
|
# linked_tables = linked_tables.get(table._tablename, [])
|
||||||
if linked_tables is None or referee in linked_tables:
|
if linked_tables is None or referee in linked_tables:
|
||||||
field.represent = lambda id, r=None, referee=referee, rep=field.represent: A(callable(rep) and rep(id) or id, _class=trap_class(), _href=url(args=['view', referee, id]))
|
field.represent = lambda id, r=None, referee=referee, rep=field.represent: A(callable(rep) and rep(id) or id, cid=request.cid, _href=url(args=['view', referee, id]))
|
||||||
except (KeyError, ValueError, TypeError):
|
except (KeyError, ValueError, TypeError):
|
||||||
redirect(URL(args=table._tablename))
|
redirect(URL(args=table._tablename))
|
||||||
if nargs == len(args) + 1:
|
if nargs == len(args) + 1:
|
||||||
@@ -2668,7 +2679,7 @@ class SQLFORM(FORM):
|
|||||||
args0 = tablename + '.' + fieldname
|
args0 = tablename + '.' + fieldname
|
||||||
links.append(
|
links.append(
|
||||||
lambda row, t=t, nargs=nargs, args0=args0:
|
lambda row, t=t, nargs=nargs, args0=args0:
|
||||||
A(SPAN(t), _class=trap_class(), _href=url(
|
A(SPAN(t), cid=request.cid, _href=url(
|
||||||
args=[args0, row[id_field_name]])))
|
args=[args0, row[id_field_name]])))
|
||||||
|
|
||||||
grid = SQLFORM.grid(query, args=request.args[:nargs], links=links,
|
grid = SQLFORM.grid(query, args=request.args[:nargs], links=links,
|
||||||
@@ -2679,7 +2690,7 @@ class SQLFORM(FORM):
|
|||||||
header = table._plural
|
header = table._plural
|
||||||
next = grid.create_form or grid.update_form or grid.view_form
|
next = grid.create_form or grid.update_form or grid.view_form
|
||||||
breadcrumbs.append(LI(
|
breadcrumbs.append(LI(
|
||||||
A(T(header), _class=trap_class(),_href=url()),
|
A(T(header), cid=request.cid,_href=url()),
|
||||||
SPAN(divider, _class='divider') if next else '',
|
SPAN(divider, _class='divider') if next else '',
|
||||||
_class='active w2p_grid_breadcrumb_elem'))
|
_class='active w2p_grid_breadcrumb_elem'))
|
||||||
if grid.create_form:
|
if grid.create_form:
|
||||||
@@ -2694,7 +2705,7 @@ class SQLFORM(FORM):
|
|||||||
grid.view_form.record))
|
grid.view_form.record))
|
||||||
if next:
|
if next:
|
||||||
breadcrumbs.append(LI(
|
breadcrumbs.append(LI(
|
||||||
A(T(header), _class=trap_class(),_href=url()),
|
A(T(header), cid=request.cid,_href=url()),
|
||||||
_class='active w2p_grid_breadcrumb_elem'))
|
_class='active w2p_grid_breadcrumb_elem'))
|
||||||
grid.insert(
|
grid.insert(
|
||||||
0, DIV(UL(*breadcrumbs, **{'_class': breadcrumbs_class}),
|
0, DIV(UL(*breadcrumbs, **{'_class': breadcrumbs_class}),
|
||||||
|
|||||||
+2
-2
@@ -1005,7 +1005,7 @@ def console():
|
|||||||
if not os.path.exists('applications/__init__.py'):
|
if not os.path.exists('applications/__init__.py'):
|
||||||
write_file('applications/__init__.py', '')
|
write_file('applications/__init__.py', '')
|
||||||
|
|
||||||
return (options, args)
|
return options, args
|
||||||
|
|
||||||
|
|
||||||
def check_existent_app(options, appname):
|
def check_existent_app(options, appname):
|
||||||
@@ -1022,7 +1022,7 @@ def get_code_for_scheduler(app, options):
|
|||||||
code = code % ("','".join(app[1:]))
|
code = code % ("','".join(app[1:]))
|
||||||
app_ = app[0]
|
app_ = app[0]
|
||||||
if not check_existent_app(options, app_):
|
if not check_existent_app(options, app_):
|
||||||
print "Application '%s' doesn't exist, skipping" % (app_)
|
print "Application '%s' doesn't exist, skipping" % app_
|
||||||
return None, None
|
return None, None
|
||||||
return app_, code
|
return app_, code
|
||||||
|
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ NameVirtualHost *:80
|
|||||||
NameVirtualHost *:443
|
NameVirtualHost *:443
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
WSGIDaemonProcess web2py user=apache group=apache
|
WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1
|
||||||
WSGIProcessGroup web2py
|
WSGIProcessGroup web2py
|
||||||
WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
|
WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
|
||||||
|
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ NameVirtualHost *:80
|
|||||||
NameVirtualHost *:443
|
NameVirtualHost *:443
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
WSGIDaemonProcess web2py user=apache group=apache
|
WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1
|
||||||
WSGIProcessGroup web2py
|
WSGIProcessGroup web2py
|
||||||
WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
|
WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
|
||||||
WSGIPassAuthorization On
|
WSGIPassAuthorization On
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ NameVirtualHost *:443
|
|||||||
# within a virtual host container, only WSGI applications associated with
|
# within a virtual host container, only WSGI applications associated with
|
||||||
# virtual hosts with the same server name as that virtual host can be
|
# virtual hosts with the same server name as that virtual host can be
|
||||||
# delegated to that set of daemon processes.
|
# delegated to that set of daemon processes.
|
||||||
WSGIDaemonProcess web2py user=www-data group=www-data
|
WSGIDaemonProcess web2py user=www-data group=www-data processes=1 threads=1
|
||||||
|
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
WSGIProcessGroup web2py
|
WSGIProcessGroup web2py
|
||||||
|
|||||||
Reference in New Issue
Block a user