From d431206e30e11dc70c44ebd41b543c02864922db Mon Sep 17 00:00:00 2001 From: Tim Richardson Date: Sat, 4 May 2013 22:13:15 +1000 Subject: [PATCH 1/5] Fixed a very minor typo --- applications/welcome/controllers/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/welcome/controllers/default.py b/applications/welcome/controllers/default.py index 3da8b325..005b558a 100644 --- a/applications/welcome/controllers/default.py +++ b/applications/welcome/controllers/default.py @@ -2,7 +2,7 @@ # this file is released under public domain and you can use without limitations ######################################################################### -## This is a samples controller +## This is a sample controller ## - index is the default action of any application ## - user is required for authentication and authorization ## - download is for downloading files uploaded in the db (does streaming) From d454eb2fe71f15d36d85ad3baacc60a53f1deba2 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 4 May 2013 10:11:55 -0500 Subject: [PATCH 2/5] removed unwated file --- .../admin/static/js/web2py_bootstrap.j | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 applications/admin/static/js/web2py_bootstrap.j diff --git a/applications/admin/static/js/web2py_bootstrap.j b/applications/admin/static/js/web2py_bootstrap.j deleted file mode 100644 index 0c94fd98..00000000 --- a/applications/admin/static/js/web2py_bootstrap.j +++ /dev/null @@ -1,35 +0,0 @@ -// this code improves bootstrap menus and adds dropdown support -jQuery(function(){ - jQuery('.nav>li>a').each(function(){ - if(jQuery(this).parent().find('ul').length) - jQuery(this).attr({'class':'dropdown-toggle','data-toggle':'dropdown'}).append(''); - }); - jQuery('.nav li li').each(function(){ - if(jQuery(this).find('ul').length) - jQuery(this).addClass('dropdown-submenu'); - }); - function adjust_height_of_collapsed_nav() { - var cn = jQuery('div.collapse'); - if (cn.get(0)) { - var cnh = cn.get(0).style.height; - if (cnh>'0px'){ - cn.css('height','auto'); - } - } - } - function hoverMenu(){ - jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ - adjust_height_of_collapsed_nav(); - mi = jQuery(this).addClass('open'); - mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400); - }, function(){ - mi = jQuery(this); - mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); - }); - } - hoverMenu(); // first page load - jQuery(window).resize(hoverMenu); // on resize event - jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');}); - // make all buttons bootstrap buttons - jQuery('button, form input[type="submit"], form input[type="button"]').addClass('btn'); -}); \ No newline at end of file From 98ad12a06c98d18178fb8eb304a5f2963d36289b Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 4 May 2013 10:24:26 -0500 Subject: [PATCH 3/5] db(query)(other if cond else None).select() --- VERSION | 2 +- gluon/dal.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index f7281edd..fe40e0e2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.6-stable+timestamp.2013.05.03.22.24.45 +Version 2.4.6-stable+timestamp.2013.05.04.10.23.42 diff --git a/gluon/dal.py b/gluon/dal.py index ffc599ed..39ebdad2 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -9744,7 +9744,9 @@ class Set(object): return '' % BaseAdapter.expand(self.db._adapter,self.query) def __call__(self, query, ignore_common_filters=False): - if isinstance(query,Table): + if query is None: + return self + elif isinstance(query,Table): query = self.db._adapter.id_query(query) elif isinstance(query,str): query = Expression(self.db,query) From cabef5785197a0b83c2a6697e4b9afcdea132cc8 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 5 May 2013 10:13:26 -0500 Subject: [PATCH 4/5] improved ipv6 address checked, thanks Jonathan --- VERSION | 2 +- gluon/main.py | 4 ++-- gluon/utils.py | 12 +++++------- gluon/widget.py | 6 +++--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index fe40e0e2..16e759a9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.6-stable+timestamp.2013.05.04.10.23.42 +Version 2.4.6-stable+timestamp.2013.05.05.10.12.31 diff --git a/gluon/main.py b/gluon/main.py index 81169857..7e861cc2 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -471,11 +471,11 @@ def wsgibase(environ, responder): local_hosts.add(socket.gethostname()) local_hosts.add(fqdn) local_hosts.update([ - ip[4][0] for ip in getipaddrinfo(fqdn)]) + addrinfo[4][0] for addrinfo in getipaddrinfo(fqdn)]) if env.server_name: local_hosts.add(env.server_name) local_hosts.update([ - ip[4][0] for ip in getipaddrinfo(env.server_name)]) + addrinfo[4][0] for addrinfo in getipaddrinfo(env.server_name)]) except (socket.gaierror, TypeError): pass global_settings.local_hosts = list(local_hosts) diff --git a/gluon/utils.py b/gluon/utils.py index 1051b8c1..733c6f3a 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -298,18 +298,16 @@ def is_valid_ip_address(address): def is_loopback_ip_address(ip=None, addrinfo=None): """ Determines whether the address appears to be a loopback address. - - This assumes that the IP is valid. The IPv6 check is limited to '::1'. - + This assumes that the IP is valid. """ if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6: ip = addrinfo[4] - if not ip: + if not isinstance(ip, basestring): return False - if isinstance(ip, basestring) and ip.count('.') == 3: # IPv4 - return ip.startswith('127') or ip.startswith('::ffff:127') - return ip == '::1' # IPv6 + if ip.count('.') == 3: # IPv4 + return ip.startswith('127') or ip.startswith('::127') or ip.startswith(' 0:0:0:0:0:0:127') + return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback def getipaddrinfo(host): diff --git a/gluon/widget.py b/gluon/widget.py index a6cf6ed1..faffc653 100644 --- a/gluon/widget.py +++ b/gluon/widget.py @@ -939,9 +939,9 @@ def console(): global_settings.cmd_args = args try: - options.ips = list(set([ - addrinfo[4][0] for addrinfo in getipaddrinfo(socket.getfqdn()) - if not is_loopback_ip_address(addrinfo=addrinfo)])) + options.ips = list(set( # no duplicates + [addrinfo[4][0] for addrinfo in getipaddrinfo(socket.getfqdn()) + if not is_loopback_ip_address(addrinfo=addrinfo)])) except socket.gaierror: options.ips = [] From f02240acd3a732f439b703000b02b18ad080ce1d Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 5 May 2013 13:31:06 -0500 Subject: [PATCH 5/5] support for different representations of IPv4 in IPv6, thanks Jonathan --- VERSION | 2 +- gluon/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 16e759a9..1680411a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.6-stable+timestamp.2013.05.05.10.12.31 +Version 2.4.6-stable+timestamp.2013.05.05.13.30.20 diff --git a/gluon/utils.py b/gluon/utils.py index 733c6f3a..8a0ac07c 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -305,8 +305,8 @@ def is_loopback_ip_address(ip=None, addrinfo=None): ip = addrinfo[4] if not isinstance(ip, basestring): return False - if ip.count('.') == 3: # IPv4 - return ip.startswith('127') or ip.startswith('::127') or ip.startswith(' 0:0:0:0:0:0:127') + if ip.count('.') == 3: # IPv4 or IPv6-embedded IPv4 or IPv4-compatible IPv6 + return ip.lower().startswith(('127', '::127', '0:0:0:0:0:0:127', '::ffff:127', '0:0:0:0:0:ffff:127')) return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback