From b5056b04f8254d06c9f13751bd38248018f51f93 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 24 Jun 2013 01:48:48 -0500 Subject: [PATCH 1/3] fixed __delattr__, thanks Vinicius --- VERSION | 2 +- gluon/dal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d733dfd4..1fa62a7d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.23.08.50.58 +Version 2.5.1-stable+timestamp.2013.06.24.01.48.00 diff --git a/gluon/dal.py b/gluon/dal.py index b67fc3d2..e36ee7ba 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6863,7 +6863,7 @@ class Row(object): def __setitem__(self, key, value): setattr(self, str(key), value) - __delitem__ = delattr + __delitem__ = object.__delattr__ __copy__ = lambda self: Row(self) From fd833be535e62460c09adb4ecaaab782a31a7fa7 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 24 Jun 2013 02:07:18 -0500 Subject: [PATCH 2/3] edited link to realpython --- VERSION | 2 +- .../private/content/en/default/documentation/more.markmin | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 1fa62a7d..dc6e2383 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.24.01.48.00 +Version 2.5.1-stable+timestamp.2013.06.24.02.06.34 diff --git a/applications/examples/private/content/en/default/documentation/more.markmin b/applications/examples/private/content/en/default/documentation/more.markmin index fb0d29fc..58dd1ebf 100644 --- a/applications/examples/private/content/en/default/documentation/more.markmin +++ b/applications/examples/private/content/en/default/documentation/more.markmin @@ -9,7 +9,7 @@ #### Learning and Demos - [[Intro video http://www.youtube.com/watch?v=BXzqmHx6edY]] and [[code examples https://github.com/mjhea0/web2py]] - [[Killer Web Development Tutorial http://killer-web-development.com/]] -- [[Real Python for the Web http://www.kickstarter.com/projects/1369857650/real-python-for-web-development-featuring-web2py]] +- [[Real Python for the Web http://www.realpython.com]] (web development with web2py and more!) - [[Admin Demo http://www.web2py.com/demo_admin popup]] (web-based IDE) - [[Welcome App Demo http://www.web2py.com/welcome]] (scaffolding application) - [[Videos http://www.web2py.com/examples/default/videos/]] From 7564f5f6711d6bd9e594888a2bee8ab9d917c777 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 24 Jun 2013 14:24:36 -0500 Subject: [PATCH 3/3] speedup CONTAINS when un-necessary REPLACE --- VERSION | 2 +- gluon/dal.py | 19 ++++++++++++++----- gluon/tools.py | 3 ++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index dc6e2383..8477ccdf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.24.02.06.34 +Version 2.5.1-stable+timestamp.2013.06.24.14.23.41 diff --git a/gluon/dal.py b/gluon/dal.py index c4529b44..b837a50e 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -1255,13 +1255,22 @@ class BaseAdapter(ConnectionPool): return '(%s LIKE %s)' % (self.expand(first), self.expand('%'+second, 'string')) - def CONTAINS(self,first,second,case_sensitive=False): + def CONTAINS(self,first,second,case_sensitive=False): if first.type in ('string','text', 'json'): - second = Expression(None,self.CONCAT('%',Expression( - None,self.REPLACE(second,('%','%%'))),'%')) + if isinstance(second,Expression): + second = Expression(None,self.CONCAT('%',Expression( + None,self.REPLACE(second,('%','%%'))),'%')) + else: + second = '%'+str(second).replace('%','%%')+'%' elif first.type.startswith('list:'): - second = Expression(None,self.CONCAT('%|',Expression(None,self.REPLACE( - Expression(None,self.REPLACE(second,('%','%%'))),('|','||'))),'|%')) + if isinstance(second,Expression): + second = Expression(None,self.CONCAT( + '%|',Expression(None,self.REPLACE( + Expression(None,self.REPLACE( + second,('%','%%'))),('|','||'))),'|%')) + else: + second = '%|'+str(second).replace('%','%%')\ + .replace('|','||')+'|%' op = case_sensitive and self.LIKE or self.ILIKE return op(first,second) diff --git a/gluon/tools.py b/gluon/tools.py index 57486531..37069c32 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -1791,7 +1791,8 @@ class Auth(object): guess = keys.get('email', 'anonymous').split('@')[0] keys['first_name'] = keys.get('username', guess) user_id = table_user.insert(**table_user._filter_fields(keys)) - user = self.user = table_user[user_id] + user = self.user = table_user[user_id] + print user if self.settings.create_user_groups: group_id = self.add_group( self.settings.create_user_groups % user)