Re: [web2py] Type Cast Field On The Fly

2015-10-22 Thread Johann Spies
On 20 October 2015 at 20:03, Benson Myrtil  wrote:

> Hey guys,
>
> I have a quick question. Does the DAL support type casting on the fly? I
> am working with a legacy mssql 2008 database that I cannot alter. Within
> this database it has a field of integers but the field type is string. When
> I try to run the sum() function on that field I get  'gluon.contrib.pypyodbc.ProgrammingError'>((u'42000', u'[42000]
> [FreeTDS][SQL Server]Operand data type char is invalid for sum operator.'))
>
>
Try sum(int(db.sometable.somevalue))

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: PostgreSQL

2015-10-22 Thread Johann Spies
Also look at this:
http://www.dbta.com/Editorial/Trends-and-Applications/Best-Database-Overall%C2%AD-105362.aspx

Regards
Johann

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Setting up database table with date.

2015-10-22 Thread Johann Spies
On 20 October 2015 at 14:16, Garry Smith  wrote:

> group and stop receiving emails from it, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Which database do you use and how is the date format specified in that
database?

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Enabling Google Sign-In

2015-10-22 Thread Michele Comitini
http://web2py.com/books/default/chapter/29/09/access-control?search=oauth#Other-login-methods-and-login-forms


Grab the file google_auth.json from the google developer console and put in
private dir of your app

put  code similar to the one below in db.py:


from gluon.contrib.login_methods.oauth20_account import OAuthAccount

try:
import json
except ImportError:
from gluon.contrib import simplejson as json


class GoogleAccount(OAuthAccount):
"OAuth 2.0 for Google"

def __init__(self):
with open(os.path.join(request.folder, 'private/google_auth.json'),
'rb') as f:
gai = Storage(json.load(f)['web'])

OAuthAccount.__init__(self, None, gai.client_id, gai.client_secret,
  gai.auth_uri, gai.token_uri,
  scope='
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/userinfo.email',
  approval_prompt='force',
state="auth_provider=google")


def get_user(self):

token = self.accessToken()
if not token:
return None

uinfo_url = '
https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' %
urllib2.quote(token, safe='')

uinfo = None

try:
uinfo_stream = urllib2.urlopen(uinfo_url)
except:
session.token = None
return
data = uinfo_stream.read()
uinfo = json.loads(data)

username = uinfo['id']

return dict(first_name = uinfo['given_name'],
last_name = uinfo['family_name'],
username = username,
email = uinfo['email'])

auth.settings.login_form = GoogleAccount()


2015-10-22 11:02 GMT+02:00 Leonel Câmara :

> I would try to use this:
>
> https://code.google.com/p/w2p-social-auth/
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: PostgreSQL

2015-10-22 Thread Michele Comitini
Couldn't agree more.  Well engineered from the ground up.
Been using it for 20+ years, I saw it steadily improving by giving little
attention to the fuzz of the moment.
I must admit that I become so spoiled, that if something new and really
useful appears on the scene of DBs I wait postgres to implement it before
trying something else... ;-)

2015-10-22 8:27 GMT+02:00 Johann Spies :

> Also look at this:
> http://www.dbta.com/Editorial/Trends-and-Applications/Best-Database-Overall%C2%AD-105362.aspx
>
> Regards
> Johann
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Enabling Google Sign-In

2015-10-22 Thread Michele Comitini
yup it would be nice if it were maintained and moved to github...

2015-10-22 17:40 GMT+02:00 Niphlod :

> I didn't know about w2p-social-auth and I'm starting to thinking that we
> should "promote it" and discourage all social-own-cooked pieces inside
> contrib/login_methods...
>
>
> On Thursday, October 22, 2015 at 1:27:35 PM UTC+2, mcm wrote:
>
>>
>> http://web2py.com/books/default/chapter/29/09/access-control?search=oauth#Other-login-methods-and-login-forms
>>
>>
>> Grab the file google_auth.json from the google developer console and put
>> in private dir of your app
>>
>> put  code similar to the one below in db.py:
>>
>>
>> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>>
>> try:
>> import json
>> except ImportError:
>> from gluon.contrib import simplejson as json
>>
>>
>> class GoogleAccount(OAuthAccount):
>> "OAuth 2.0 for Google"
>>
>> def __init__(self):
>> with open(os.path.join(request.folder,
>> 'private/google_auth.json'), 'rb') as f:
>> gai = Storage(json.load(f)['web'])
>>
>> OAuthAccount.__init__(self, None, gai.client_id,
>> gai.client_secret,
>>   gai.auth_uri, gai.token_uri,
>>   scope='
>> https://www.googleapis.com/auth/userinfo.profile
>> https://www.googleapis.com/auth/userinfo.email',
>>   approval_prompt='force',
>> state="auth_provider=google")
>>
>>
>> def get_user(self):
>>
>> token = self.accessToken()
>> if not token:
>> return None
>>
>> uinfo_url = '
>> https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' %
>> urllib2.quote(token, safe='')
>>
>> uinfo = None
>>
>> try:
>> uinfo_stream = urllib2.urlopen(uinfo_url)
>> except:
>> session.token = None
>> return
>> data = uinfo_stream.read()
>> uinfo = json.loads(data)
>>
>> username = uinfo['id']
>>
>> return dict(first_name = uinfo['given_name'],
>> last_name = uinfo['family_name'],
>> username = username,
>> email = uinfo['email'])
>>
>> auth.settings.login_form = GoogleAccount()
>>
>>
>> 2015-10-22 11:02 GMT+02:00 Leonel Câmara :
>>
>>> I would try to use this:
>>>
>>> https://code.google.com/p/w2p-social-auth/
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: nginx setup: [Errno 13] Permission denied: '/root/.python-eggs'

2015-10-22 Thread Niphlod
this log smells about a not-so-fresh installation (seems more like a second 
run of the same script).
Apart from that (drop the VPS and recreate a fresh one), there is a weird 
error at the top which points to being in an unusual environment (setup.sh: 
5: setup.sh: [[: not found)

how did you get in that shell ?
sudo su - ?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to update db record using ajax?

2015-10-22 Thread Edward Shave
Thanks a bunch for your very detailed reply.
After reading your post I have managed to get a version working just the 
way I want.
Thanks again,
Ed

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Oracle drivers.

2015-10-22 Thread Michael M
Tried it again.

This time I tried on another RHEL 7 server.

Downloaded Oracle's Instant Client Zips and extracted all of them instead 
of installing RPMs
Same with the cx_Oracle Module.  didnt install the RPM got the source and 
complied.

I set the envoirment variables

export ORACLE_HOME=/usr/include/oracle/11.1
export LD_LIBRARY_PATH=$ORACLE_HOME/
export PATH=$ORACLE_HOME/bin:$PATH

Created a symlink: ln -s libclntsh.so.11.1 libclntsh.so

I compiled this time 'cx_Oracle-5.1.2.tar.gz' with python setup.py build && 
python setup.py install

Still able to launch python from CLI and import cx_Oracle without problems
Still able to launch Web2py from CLI to see "cx_Oracle" in the Available 
drivers line.

Still unable to load an application that has the DB pointing to a oracle:// 
URI without a ticket being auto-generating.

Would finding an older version of Web2py maybe help?

On Wednesday, October 14, 2015 at 8:37:54 AM UTC-7, Michael M wrote:
>
> Has anyone been able to reproduce this?  And I don't think you actually 
> need an Oracle system.  Just pointing to a Oracle URI will cause the error 
> on my side.
>
> On Thursday, October 8, 2015 at 12:09:45 PM UTC-7, Michael M wrote:
>>
>> Thank-you Niphlod!
>>
>> On Thursday, October 8, 2015 at 12:08:40 PM UTC-7, Niphlod wrote:
>>>
>>> the repo for pydal is the other one no worries though, I linked your 
>>> one in https://github.com/web2py/pydal/issues/299
>>>
>>> On Thursday, October 8, 2015 at 3:13:11 AM UTC+2, Michael M wrote:

 Submitted:
 https://github.com/web2py/web2py/issues/1082

 On Wednesday, October 7, 2015 at 5:29:43 PM UTC-7, Massimo Di Pierro 
 wrote:
>
> This may be a bug. Can you please open a pydal ticket and we will 
> check it asap?
>
> On Wednesday, 7 October 2015 14:50:13 UTC-5, Michael M wrote:
>>
>> Never checked there.  But it is.
>>
>> $ python web2py.py
>> web2py Web Framework
>> Created by Massimo Di Pierro, Copyright 2007-2015
>> Version 2.12.3-stable+timestamp.2015.08.19.00.18.03
>> Database drivers available: cx_Oracle, pymysql, imaplib, sqlite3, 
>> pg8000, pyodbc
>>
>> Weird.  just rebooted the Virt. and still getting:
>>
>> Traceback (most recent call last):
>>   File "/opt/www-data/web2py/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File "/opt/www-data/web2py/applications/test/models/db.py" 
>> , line 20, 
>> in 
>> db = DAL(myconf.take('db.uri'), 
>> pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>> 174, in __call__
>> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>> 459, in __init__
>> raise RuntimeError("Failure to connect, tried %d times:\n%s" % 
>> (attempts, tb))
>> RuntimeError: Failure to connect, tried 5 times:
>> Traceback (most recent call last):
>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>> 437, in __init__
>> self._adapter = ADAPTERS[self._dbname](**kwargs)
>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 57, in __call__
>> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>>   File 
>> "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", line 
>> 105, in __init__
>> if do_connect: self.find_driver(adapter_args,uri)
>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 188, in find_driver
>> raise RuntimeError("no driver available %s" % str(self.drivers))
>> RuntimeError: no driver available ('cx_Oracle',)
>>
>>
>> On Wednesday, October 7, 2015 at 12:45:19 PM UTC-7, Willoughby wrote:
>>>
>>> When you start web2py from a command line it should list 'Database 
>>> drivers available' - is it on that list?
>>>
>>> On Wednesday, October 7, 2015 at 3:12:01 PM UTC-4, Michael M wrote:

 Just to cover more basis I installed the following:

 sudo rpm -Uvh

 oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
 oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
 oracle-instantclient11.2-jdbc-11.2.0.4.0-1.x86_64.rpm
 oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm
 oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
 oracle-instantclient11.2-tools-11.2.0.4.0-1.x86_64.rpm

 then 

 cx_Oracle-5.1.2-11g-py27-1.x86_64.rpm

 Still no dice in Web2py


 On Tuesday, October 6, 2015 at 5:09:18 PM UTC-7, Michael M wrote:
>
> I was testing in non-prod (RHEL) to see if it 

[web2py] Re: Oracle drivers.

2015-10-22 Thread Michael M
Is it Possible that the DAL is talking Python 3.4 when my driver is Python 
2.7.  So when I call it in Web2py from CLI it works but when the framework 
is running its trying to call 3.4 to talk to cx_Oracle?

See below:
2.12.3-stable+timestamp.2015.08.19.00.18.03
(Running on Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips 
mod_wsgi/3.4 Python/2.7.5, Python 2.7.5)

The Running Shows 3.4 Python/2.7.5, Python 2.7.5. could that contribute to 
the issue?  Or am i reading it wrong?

Thanks!


On Thursday, October 22, 2015 at 3:28:31 PM UTC-7, Michael M wrote:
>
> Tried it again.
>
> This time I tried on another RHEL 7 server.
>
> Downloaded Oracle's Instant Client Zips and extracted all of them instead 
> of installing RPMs
> Same with the cx_Oracle Module.  didnt install the RPM got the source and 
> complied.
>
> I set the envoirment variables
>
> export ORACLE_HOME=/usr/include/oracle/11.1
> export LD_LIBRARY_PATH=$ORACLE_HOME/
> export PATH=$ORACLE_HOME/bin:$PATH
>
> Created a symlink: ln -s libclntsh.so.11.1 libclntsh.so
>
> I compiled this time 'cx_Oracle-5.1.2.tar.gz' with python setup.py build 
> && python setup.py install
>
> Still able to launch python from CLI and import cx_Oracle without problems
> Still able to launch Web2py from CLI to see "cx_Oracle" in the Available 
> drivers line.
>
> Still unable to load an application that has the DB pointing to a 
> oracle:// URI without a ticket being auto-generating.
>
> Would finding an older version of Web2py maybe help?
>
> On Wednesday, October 14, 2015 at 8:37:54 AM UTC-7, Michael M wrote:
>>
>> Has anyone been able to reproduce this?  And I don't think you actually 
>> need an Oracle system.  Just pointing to a Oracle URI will cause the error 
>> on my side.
>>
>> On Thursday, October 8, 2015 at 12:09:45 PM UTC-7, Michael M wrote:
>>>
>>> Thank-you Niphlod!
>>>
>>> On Thursday, October 8, 2015 at 12:08:40 PM UTC-7, Niphlod wrote:

 the repo for pydal is the other one no worries though, I linked 
 your one in https://github.com/web2py/pydal/issues/299

 On Thursday, October 8, 2015 at 3:13:11 AM UTC+2, Michael M wrote:
>
> Submitted:
> https://github.com/web2py/web2py/issues/1082
>
> On Wednesday, October 7, 2015 at 5:29:43 PM UTC-7, Massimo Di Pierro 
> wrote:
>>
>> This may be a bug. Can you please open a pydal ticket and we will 
>> check it asap?
>>
>> On Wednesday, 7 October 2015 14:50:13 UTC-5, Michael M wrote:
>>>
>>> Never checked there.  But it is.
>>>
>>> $ python web2py.py
>>> web2py Web Framework
>>> Created by Massimo Di Pierro, Copyright 2007-2015
>>> Version 2.12.3-stable+timestamp.2015.08.19.00.18.03
>>> Database drivers available: cx_Oracle, pymysql, imaplib, sqlite3, 
>>> pg8000, pyodbc
>>>
>>> Weird.  just rebooted the Virt. and still getting:
>>>
>>> Traceback (most recent call last):
>>>   File "/opt/www-data/web2py/gluon/restricted.py", line 227, in 
>>> restricted
>>> exec ccode in environment
>>>   File "/opt/www-data/web2py/applications/test/models/db.py" 
>>> , line 20, 
>>> in 
>>> db = DAL(myconf.take('db.uri'), 
>>> pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
>>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>>> 174, in __call__
>>> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>>> 459, in __init__
>>> raise RuntimeError("Failure to connect, tried %d times:\n%s" % 
>>> (attempts, tb))
>>> RuntimeError: Failure to connect, tried 5 times:
>>> Traceback (most recent call last):
>>>   File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 
>>> 437, in __init__
>>> self._adapter = ADAPTERS[self._dbname](**kwargs)
>>>   File 
>>> "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 57, in __call__
>>> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>>>   File 
>>> "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", 
>>> line 105, in __init__
>>> if do_connect: self.find_driver(adapter_args,uri)
>>>   File 
>>> "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 188, in find_driver
>>> raise RuntimeError("no driver available %s" % str(self.drivers))
>>> RuntimeError: no driver available ('cx_Oracle',)
>>>
>>>
>>> On Wednesday, October 7, 2015 at 12:45:19 PM UTC-7, Willoughby wrote:

 When you start web2py from a command line it should list 'Database 
 drivers available' - is it on that list?

 On Wednesday, October 7, 2015 at 3:12:01 PM UTC-4, Michael M wrote:
>
> Just to cover more basis I installed 

Re: [web2py] Re: nginx setup: [Errno 13] Permission denied: '/root/.python-eggs'

2015-10-22 Thread Luciano Laporta Podazza
Hello again,

So I did recreate the VPS and everythng worked as expected :/

Even so, it still throws the "setup.sh: 5: setup.sh: [[: not found".  I
just logged in as r...@mydomain.com and call the setup.sh script.

Thanks a lot for your help!!! :)

On Thu, Oct 22, 2015 at 6:22 PM, Niphlod  wrote:

> this log smells about a not-so-fresh installation (seems more like a
> second run of the same script).
> Apart from that (drop the VPS and recreate a fresh one), there is a weird
> error at the top which points to being in an unusual environment (setup.sh:
> 5: setup.sh: [[: not found)
>
> how did you get in that shell ?
> sudo su - ?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/S4DcLQ1MEAQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Atte
Luciano Laporta Podazza

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] is the auto-increment integer primary key field indexed?

2015-10-22 Thread Alex Glaros
is the default primary key indexed?

I mean if I had 1 million addresses, with countryID as a foreign key, would 
the look-up be faster searching on primary key or would it take same time 
as searching on something like foreign key country_code "US", "MX", etc.?

thanks

Alex Glaros

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: is the auto-increment integer primary key field indexed?

2015-10-22 Thread Anthony
Yes, I think most databases automatically index the primary key. Note, 
web2py stores the database timings for the queries in a given request 
(which can be viewed in response.toolbar(), so you can compare the speed of 
different queries).

Anthony

On Thursday, October 22, 2015 at 7:22:35 PM UTC-4, Alex Glaros wrote:
>
> is the default primary key indexed?
>
> I mean if I had 1 million addresses, with countryID as a foreign key, 
> would the look-up be faster searching on primary key or would it take same 
> time as searching on something like foreign key country_code "US", "MX", 
> etc.?
>
> thanks
>
> Alex Glaros
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Enabling Google Sign-In

2015-10-22 Thread Leonel Câmara
I would try to use this:

https://code.google.com/p/w2p-social-auth/

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Voting In Massimo's Week 2 Video

2015-10-22 Thread Vinicius Assef
Do you have the link for the videos?

--
Vinicius Assef


On 22 October 2015 at 02:49, Joffrey Baratheon
 wrote:
> In Massimo's week 2 video for Web2py, he went over a Reddit style app. He
> never explained how to implement the vote button even though he created the
> infrastructure for doing so. Has anyone successfully implemented them? I'm
> having a tough time with it.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Ractive and Single Page Apps

2015-10-22 Thread Michele Comitini
This ractive extension could be of interest to you IMHO:

http://ractive-require.codecorico.com/

2015-10-22 10:11 GMT+02:00 p a :

> Two more comments:
>
> - I don't intend to push all logic to the server, but only the "view" part
> in web2py. My long term goal is to have a working API, and many ractive
> components that can be combined in different ways, and allow to show data
> and/or interact with it independently. Then a person joining the team will
> have an easier job if she wants to work only on the front, in javascript,
> or only on the server, in python. The work I'm doing right now is also
> trying to fix all the routes that did not work well in json, for one reason
> or another. Maybe it will open new chances for interoperability with other
> software. Before I started to do this transformation, returning a dict with
> only raw data from every controller was only a question of
> discipline/aestetics, but now it's for real.
>
> - There's another issue that you may run into, Rod, and it's redirections.
> The solution is bytesize, if you can find it. My solution was to modify
> web2py.js, from:
>
> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>
> if(redirect !== null) {
>   window.location = redirect;
>
>
> to:
>
> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>
> if(redirect !== null) {
>   YourRouter.navTo(redirect);
>
>
> and use client_side=True on web2py so that it returns a 200 code instead
> of a 303 code. That way redirections work fine with page.js. Maybe in
> crossroads.js you can find other solutions, page.js seems simpler to use
> but more constrained.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Ractive and Single Page Apps

2015-10-22 Thread Rod Watkins
This looks cool. I had not found this. I plan to study it today.
Rod

On Thursday, October 22, 2015 at 3:17:00 AM UTC-7, mcm wrote:
>
> This ractive extension could be of interest to you IMHO:
>
> http://ractive-require.codecorico.com/
>
> 2015-10-22 10:11 GMT+02:00 p a :
>
>> Two more comments:
>>
>> - I don't intend to push all logic to the server, but only the "view" 
>> part in web2py. My long term goal is to have a working API, and many 
>> ractive components that can be combined in different ways, and allow to 
>> show data and/or interact with it independently. Then a person joining the 
>> team will have an easier job if she wants to work only on the front, in 
>> javascript, or only on the server, in python. The work I'm doing right now 
>> is also trying to fix all the routes that did not work well in json, for 
>> one reason or another. Maybe it will open new chances for interoperability 
>> with other software. Before I started to do this transformation, returning 
>> a dict with only raw data from every controller was only a question of 
>> discipline/aestetics, but now it's for real.
>>
>> - There's another issue that you may run into, Rod, and it's 
>> redirections. The solution is bytesize, if you can find it. My solution was 
>> to modify web2py.js, from:
>>
>> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>>
>> if(redirect !== null) {
>>   window.location = redirect;
>>
>>
>> to:
>>
>> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>>
>> if(redirect !== null) {
>>   YourRouter.navTo(redirect);
>>
>>
>> and use client_side=True on web2py so that it returns a 200 code instead 
>> of a 303 code. That way redirections work fine with page.js. Maybe in 
>> crossroads.js you can find other solutions, page.js seems simpler to use 
>> but more constrained.
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Fwd: aiosmtpd 1.0a1 - asyncio-based implementations of SMTP/LMTP

2015-10-22 Thread Michele Comitini
Works on python2.7? or only 3.5?

2015-10-20 16:06 GMT+02:00 Massimo DiPierro :

> This is nice if you want a pure python SMTP server
>
> Begin forwarded message:
>
> *From: *Barry Warsaw 
> *Subject: **aiosmtpd 1.0a1 - asyncio-based implementations of SMTP/LMTP*
> *Date: *October 20, 2015 at 8:51:29 AM CDT
> *To: *
> *Reply-To: *python-l...@python.org
>
> I'm very happy to announce the first alpha release of aiosmtpd, an
> asyncio-based implementation of SMTP and LMTP.
>
> http://aiosmtpd.readthedocs.org/en/latest/
> https://pypi.python.org/pypi/aiosmtpd/1.0a1
>
> This library can be used as a standalone server, or as a testing framework
> for
> applications that send email.  It's inspired by several previous packages
> including the stdlib smtpd.py, lazr.smtptest, Benjamin Bader's aiosmtp, and
> submodules in GNU Mailman.
>
> This is an alpha release, so it can obviously use lots of feedback, and
> contributions are very much welcome.  We're developing the library on
> GitLab;
> see the RTD link above for details.
>
> Brought to you by the aiosmtpd hacking cabal of Andrew Kuchling, Eric
> Smith,
> Jason Coombs, R. David Murray and myself.
>
> Our aim is to include aiosmtpd in the Python 3.6 stdlib as a better
> alternative to smtpd.py.
>
> Cheers,
> -Barry
> --
> https://mail.python.org/mailman/listinfo/python-announce-list
>
>Support the Python Software Foundation:
>http://www.python.org/psf/donations/
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] DAL alternatives

2015-10-22 Thread António Ramos
I agree with you except for the "kept secret" because it keeps away people
that could help make it even better.
and yes, i meant pyDAL

2015-10-22 14:53 GMT+01:00 Richard Vézina :

> Do you mean pyDAL?
>
> If so, you have to consider that it is very young and may still seems to
> be web2py related which may make poeple think that they can't use it
> without web2py...
>
> I use to refer many StackOverflow asker to pyDAL as a way to solve their
> issue, I guess word of mouth is not in use enough.
>
> Anyway pyDAL is amanzing piece of software and I don't mind if it stays a
> really good kept secret...
>
> :)
>
> Richard
>
> On Thu, Oct 22, 2015 at 8:52 AM, António Ramos 
> wrote:
>
>> Why is there very litle interest in the DAL github repo (very litle forks
>> and stars) ?
>>
>> Are people using better alternatives or does it suffer from some lack of
>> publicity or even worse, people dont like it because they dont like web2py
>> either.
>>
>> Regards
>> António
>>
>>
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Ractive and Single Page Apps

2015-10-22 Thread Rod Watkins
The redirection trick is good to know. Little gotchas like that can drive 
you nuts.  I'll put this in my vault for later when I try to learn how to 
use ractive for my app.

On Thursday, October 22, 2015 at 1:11:13 AM UTC-7, p a wrote:
>
> Two more comments:
>
> - I don't intend to push all logic to the server, but only the "view" part 
> in web2py. My long term goal is to have a working API, and many ractive 
> components that can be combined in different ways, and allow to show data 
> and/or interact with it independently. Then a person joining the team will 
> have an easier job if she wants to work only on the front, in javascript, 
> or only on the server, in python. The work I'm doing right now is also 
> trying to fix all the routes that did not work well in json, for one reason 
> or another. Maybe it will open new chances for interoperability with other 
> software. Before I started to do this transformation, returning a dict with 
> only raw data from every controller was only a question of 
> discipline/aestetics, but now it's for real.
>
> - There's another issue that you may run into, Rod, and it's redirections. 
> The solution is bytesize, if you can find it. My solution was to modify 
> web2py.js, from:
>
> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>
> if(redirect !== null) {
>   window.location = redirect;
>
>
> to:
>
> var redirect = xhr.getResponseHeader('web2py-redirect-location');
>
> if(redirect !== null) {
>   YourRouter.navTo(redirect);
>
>
> and use client_side=True on web2py so that it returns a 200 code instead 
> of a 303 code. That way redirections work fine with page.js. Maybe in 
> crossroads.js you can find other solutions, page.js seems simpler to use 
> but more constrained.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] DAL alternatives

2015-10-22 Thread Richard Vézina
Do you mean pyDAL?

If so, you have to consider that it is very young and may still seems to be
web2py related which may make poeple think that they can't use it without
web2py...

I use to refer many StackOverflow asker to pyDAL as a way to solve their
issue, I guess word of mouth is not in use enough.

Anyway pyDAL is amanzing piece of software and I don't mind if it stays a
really good kept secret...

:)

Richard

On Thu, Oct 22, 2015 at 8:52 AM, António Ramos  wrote:

> Why is there very litle interest in the DAL github repo (very litle forks
> and stars) ?
>
> Are people using better alternatives or does it suffer from some lack of
> publicity or even worse, people dont like it because they dont like web2py
> either.
>
> Regards
> António
>
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Setting up database table with date.

2015-10-22 Thread Garry Smith
Hi

I am using MySQL database, the default format for date is is -00-00, 
which is *-MM-DD*.
I read you could change the format, which I tried with no effect.
What I did in the end, is change all the dates in a spreadsheet to match 
-mm-dd,  which then let me import the data. 

Thanks for your reply.

On Thursday, 22 October 2015 07:40:43 UTC+1, Johann Spies wrote:
>
>
>
> On 20 October 2015 at 14:16, Garry Smith  
> wrote:
>
>> group and stop receiving emails from it, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Which database do you use and how is the date format specified in that 
> database? 
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] DAL alternatives

2015-10-22 Thread António Ramos
Why is there very litle interest in the DAL github repo (very litle forks
and stars) ?

Are people using better alternatives or does it suffer from some lack of
publicity or even worse, people dont like it because they dont like web2py
either.

Regards
António

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Enabling Google Sign-In

2015-10-22 Thread Niphlod
I didn't know about w2p-social-auth and I'm starting to thinking that we 
should "promote it" and discourage all social-own-cooked pieces inside 
contrib/login_methods...

On Thursday, October 22, 2015 at 1:27:35 PM UTC+2, mcm wrote:
>
>
> http://web2py.com/books/default/chapter/29/09/access-control?search=oauth#Other-login-methods-and-login-forms
>
>
> Grab the file google_auth.json from the google developer console and put 
> in private dir of your app
>
> put  code similar to the one below in db.py:
>
>
> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>
> try:
> import json
> except ImportError:
> from gluon.contrib import simplejson as json
>
>
> class GoogleAccount(OAuthAccount):
> "OAuth 2.0 for Google"
>
> def __init__(self):
> with open(os.path.join(request.folder, 
> 'private/google_auth.json'), 'rb') as f:
> gai = Storage(json.load(f)['web'])
> 
> OAuthAccount.__init__(self, None, gai.client_id, gai.client_secret,
>   gai.auth_uri, gai.token_uri,
>   scope='
> https://www.googleapis.com/auth/userinfo.profile 
> https://www.googleapis.com/auth/userinfo.email',
>   approval_prompt='force', 
> state="auth_provider=google")
>
>
> def get_user(self):
>
> token = self.accessToken()
> if not token:
> return None
>
> uinfo_url = '
> https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' % 
> urllib2.quote(token, safe='')
>
> uinfo = None
>
> try:
> uinfo_stream = urllib2.urlopen(uinfo_url)
> except:
> session.token = None
> return
> data = uinfo_stream.read()
> uinfo = json.loads(data)
>
> username = uinfo['id']
> 
> return dict(first_name = uinfo['given_name'],
> last_name = uinfo['family_name'],
> username = username,
> email = uinfo['email'])
>
> auth.settings.login_form = GoogleAccount()
>
>
> 2015-10-22 11:02 GMT+02:00 Leonel Câmara  >:
>
>> I would try to use this:
>>
>> https://code.google.com/p/w2p-social-auth/
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Ractive and Single Page Apps

2015-10-22 Thread p a
Two more comments:

- I don't intend to push all logic to the server, but only the "view" part 
in web2py. My long term goal is to have a working API, and many ractive 
components that can be combined in different ways, and allow to show data 
and/or interact with it independently. Then a person joining the team will 
have an easier job if she wants to work only on the front, in javascript, 
or only on the server, in python. The work I'm doing right now is also 
trying to fix all the routes that did not work well in json, for one reason 
or another. Maybe it will open new chances for interoperability with other 
software. Before I started to do this transformation, returning a dict with 
only raw data from every controller was only a question of 
discipline/aestetics, but now it's for real.

- There's another issue that you may run into, Rod, and it's redirections. 
The solution is bytesize, if you can find it. My solution was to modify 
web2py.js, from:

var redirect = xhr.getResponseHeader('web2py-redirect-location');

if(redirect !== null) {
  window.location = redirect;


to:

var redirect = xhr.getResponseHeader('web2py-redirect-location');

if(redirect !== null) {
  YourRouter.navTo(redirect);


and use client_side=True on web2py so that it returns a 200 code instead of 
a 303 code. That way redirections work fine with page.js. Maybe in 
crossroads.js you can find other solutions, page.js seems simpler to use 
but more constrained.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Table migration problem on GAE Cloud SQL (locally)

2015-10-22 Thread Sébastien
Might this be a bug on GAE? Could someone confirm that on GAE migration is 
fine?

On Saturday, 17 October 2015 13:13:21 UTC+2, Sébastien wrote:
>
> Hello,
>
> I am working locally on GAE (with Cloud SQL) and I can't seem to be able 
> to add a new field to a table. I keep having  'xxx.table appears corrupted' 
> messages.
>
> This is what I do before getting the error.
>
>
> 1. To begin with I have:
>
> DAL('google:sql:xxx:xxx/xxx’, migrate_enabled = False, migrate=False)
> db.define_table('test', Field('name'))
>
> ---> everything all right
>
> 2. Then I change DAL connexion:
> DAL('google:sql:xxx:xxx/xxx’, migrate_enabled = True, migrate=False)
>
> 3, And update define_table with a new field + a migrate name
> db.define_table('test', Field('name'), Field('another'), 
> migrate='test.table')
>
> ---> I get the following error:
>
> […]/gluon/packages/dal/pydal/adapters/base.py:1370: Warning: Can't create 
> database 'silentdrop'; database exists
>   ret = self.cursor.execute(command, *a[1:], **b)
> […]/gluon/packages/dal/pydal/adapters/base.py:1370: Warning: Table 
> 'web2py_filesystem' already exists
>   ret = self.cursor.execute(command, *a[1:], **b)
> ERROR2015-10-17 11:06:35,531 restricted.py:174] Traceback (most recent 
> call last):
>   File "[…]/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "[…]/applications/xxx/models/xxx.py”, line 35, in 
> migrate= ‘test.table')
>   File "[…]/gluon/packages/dal/pydal/base.py", line 834, in define_table
> table = self.lazy_define_table(tablename,*fields,**args)
>   File "[…]/gluon/packages/dal/pydal/base.py", line 873, in 
> lazy_define_table
> polymodel=polymodel)
>   File "[…]/gluon/packages/dal/pydal/adapters/base.py", line 494, in 
> create_table
> raise RuntimeError('File %s appears corrupted' % table._dbt)
> RuntimeError: File $HOME/socialTV/databases/test.table appears corrupted
>
>
> I would really appreciate if someone could help me with this as I can't 
> seem to find a solution.
> Thank you!
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Google Cloud SQL: Unable to connect

2015-10-22 Thread Sébastien
Is it happening locally? Did you install MySQLdb? 

I app.yaml you have to add under "libraries"

- name: MySQLdb
  version: "latest"

Finally you have to add your MySQL credential to dev_appserver.py like:

dev_appserver.py [root folder of web2py] --mysql_user=[mysql user] 
--mysql_password=[mysql password]





On Thursday, 22 October 2015 00:39:16 UTC+2, Tom Campbell wrote:
>
> My app is named todo.
> I want to deploy it to GAE using Google Cloud SQL.
> Connection looks like this:
>
> if not request.env.web2py_runtime_gae:
> db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', 
> cast=int), check_reserved=['all'])
> else:
> db = DAL('google:sql://gigcity-1951:dbtest/tomsdatabase')
> # etc.
>
> When I try to connect I get an "Internal error":
> https://gigcity-1951.appspot.com/todo/
>
> If I click the ticket link the ticket's missing.
>
> Clue: It's not asking me for my Google credentials.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py][share] usefull snippet for enhance list of tags to be displayed in a table cell (or TD)

2015-10-22 Thread Richard
Hello,

When building from scratch an HTML Table with web2py helper I found myself 
needing to split list of A() tags with CAT(', ') tag to proper display of 
tags list in HTML.

So, I have write this little snippet that I found usefull for that :

def cat_comma_snippet(tag_to_be_split_with_cat_comma):
"""
Take a iterable list of web2py tag(s) and return tags splitted with 
CAT(', ')
"""
tags_with_cat = []
if len(tag_to_be_split_with_cat_comma) > 1:
for i, l in enumerate(tag_to_be_split_with_cat_comma):
if i + 1 < len(tag_to_be_split_with_cat_comma):
tags_with_cat.extend([l, CAT(', ')])
else:
tags_with_cat.append(l)
else:
tags_with_cat = tag_to_be_split_with_cat_comma
return tags_with_cat


You can pass it this :

[A('item1_represent', _href=URL('controller', 'function', args='agrs', vars=
dict(record_id=1)), A('item2_represent', _href=URL('controller', 'function', 
args='agrs', vars=dict(record_id=2)), ...]


And it will return :

[A('item1_represent', _href=URL('controller', 'function', args='agrs', vars=
dict(record_id=1)), CAT(', '), A('item2_represent', _href=URL('controller', 
'function', args='agrs', vars=dict(record_id=2)), ...]



Enjoy...

Richard

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.