Re: [web2py] Re: Migrate from sqlite to mysql

2019-02-13 Thread 黄祥
RuntimeError: Failure to connect, tried 5 times:

seems have a connection problem between python and mysql 
perhaps you can test the connection first (via command prompt)

or perhaps an uri definition is wrong, had you try:
*private/appconfig.ini*
uri = mysql://root:passwordroot@localhost/gadb
?

best regards,
stifan

-- 
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: Migrate from sqlite to mysql

2019-02-13 Thread Ben Duncan
Yes it will create the db.define.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Feb 13, 2019 at 1:55 PM Andrea Fae'  wrote:

> Hello!
> I followed the instruction you wrote me.
> But at that point:" load web2py app, ensure migrate is true, so that will
> create the tables defined in web2py"
>
> I have this error:
>
> Error ticket for "ga"Ticket ID
>
> 127.0.0.1.2019-02-13.20-49-28.fcc1a494-3aa4-42c2-b1a9-ab14a466e72e
>  Failure to connect, tried 5 times:
> Traceback (most recent call last): File
> "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in
> __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in
> __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File
> "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__
> self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py",
> line 172, in reconnect self.connection = self.connector() File
> "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in
> connector return self.driver.connect(**self.driver_args) File
> "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return
> Connection(*args, **kwargs) File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line
> 905, in connect self._get_server_information() File
> "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in
> _get_server_information self.server_charset = charset_by_id(lang).name File
> "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return
> self._by_id[id] KeyError: 255Versione
> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
> 32.
> 33.
> 34.
> 35.
> 36.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:/web2py/applications/ga/models/db.py" 
> , line 34, in 
> 
> check_reserved=['all'])
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
> self._adapter = adapter(**kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
> __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
> __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
> __init__
> self.reconnect()
>   File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
> reconnect
> self.connection = self.connector()
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
> connector
> return self.driver.connect(**self.driver_args)
>   File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
> return Connection(*args, **kwargs)
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
> self.connect()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
> self._get_server_information()
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
> _get_server_information
> self.server_charset = charset_by_id(lang).name
>   File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
> return self._by_id[id]
> KeyError: 255
>
> In file: C:\web2py\applications\ga\models\db.py
>
> 1.
>
>  at 0AC93830, file 
> "C:\web2py\applications\ga\models\db.py", line 8
>
>
>
> This is my appconfig.ini:
>
> ; App configuration
> [app]
> name= Welcome
> author  = Your Name 
> description = a cool new app
> keywords= web2py, python, framework
> generator   = Web2py Web Framework
>
> ; Host configuration
> [host]
> names = localhost:*, 127.0.0.1:*, *:*, *
>
> ; db configuration
> [db]
> uri   = mysql://root:passwordroot@localhost/gadb?set_encoding=utf8mb4
> migrate   = true
> pool_size = 10 ; ignored for sqlite
>
> ; smtp address and credentials
> [smtp]
> server = smtp.gmail.com:587
> sender = y...@gmail.com
> login  = username:password
> tls= true
> ssl= 

[web2py] error connecting to mysql

2019-02-13 Thread Andrea Fae'
Hello. I have this error when I start application "ga"

Error ticket for "ga"
Ticket ID

127.0.0.1.2019-02-13.20-49-28.fcc1a494-3aa4-42c2-b1a9-ab14a466e72e
 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__ 
self._adapter = adapter(**kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
__call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
__init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__ 
self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", 
line 172, in reconnect self.connection = self.connector() File 
"C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
connector return self.driver.connect(**self.driver_args) File 
"C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return 
Connection(*args, **kwargs) File 
"C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__ 
self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line 
905, in connect self._get_server_information() File 
"C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
_get_server_information self.server_charset = charset_by_id(lang).name File 
"C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return 
self._by_id[id] KeyError: 255Versione
web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "C:/web2py/applications/ga/models/db.py" 
, line 34, in 
check_reserved=['all'])
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
self._adapter = adapter(**kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
__call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
__init__
super(SQLAdapter, self).__init__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
__init__
self.reconnect()
  File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
reconnect
self.connection = self.connector()
  File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
connector
return self.driver.connect(**self.driver_args)
  File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
self.connect()
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
self._get_server_information()
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
_get_server_information
self.server_charset = charset_by_id(lang).name
  File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
return self._by_id[id]
KeyError: 255

In file: C:\web2py\applications\ga\models\db.py

1.

 at 0AC93830, file 
"C:\web2py\applications\ga\models\db.py", line 8



This is my appconfig.ini:

; App configuration
[app]
name= Welcome
author  = Your Name 
description = a cool new app
keywords= web2py, python, framework
generator   = Web2py Web Framework

; Host configuration
[host]
names = localhost:*, 127.0.0.1:*, *:*, *

; db configuration
[db]
uri   = mysql://root:passwordroot@localhost/gadb?set_encoding=utf8mb4
migrate   = true
pool_size = 10 ; ignored for sqlite

; smtp address and credentials
[smtp]
server = smtp.gmail.com:587
sender = y...@gmail.com
login  = username:password
tls= true
ssl= true

; form styling
[forms]
formstyle = bootstrap3_inline
separator =

I just created the db "gadb" in mysql.exe. You can see the db, but I only 
created the db with the command

mysql> create database gadb; Query OK, 1 row affected (0.02 sec) mysql> 
show databases; ++ | Database | ++ 
| gadb | | information_schema | | mysql | | performance_schema | | sakila | 
| sys | | world | ++ 7 rows in set (0.00 sec) 

Can you help me what is my mistake?
THANK YOU

-- 
Resources:
- http://web2py.com
- http://web2py.com/book 

[web2py] Re: Migrate from sqlite to mysql

2019-02-13 Thread Andrea Fae'
Hello!
I followed the instruction you wrote me.
But at that point:" load web2py app, ensure migrate is true, so that will 
create the tables defined in web2py"

I have this error:
 
Error ticket for "ga"Ticket ID

127.0.0.1.2019-02-13.20-49-28.fcc1a494-3aa4-42c2-b1a9-ab14a466e72e
 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__ 
self._adapter = adapter(**kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
__call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
__init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
"C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__ 
self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", 
line 172, in reconnect self.connection = self.connector() File 
"C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
connector return self.driver.connect(**self.driver_args) File 
"C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return 
Connection(*args, **kwargs) File 
"C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__ 
self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line 
905, in connect self._get_server_information() File 
"C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
_get_server_information self.server_charset = charset_by_id(lang).name File 
"C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return 
self._by_id[id] KeyError: 255Versione
web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "C:/web2py/applications/ga/models/db.py" 
, line 34, in 
check_reserved=['all'])
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
self._adapter = adapter(**kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in 
__call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in 
__init__
super(SQLAdapter, self).__init__(*args, **kwargs)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in 
__init__
self.reconnect()
  File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in 
reconnect
self.connection = self.connector()
  File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in 
connector
return self.driver.connect(**self.driver_args)
  File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
self.connect()
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
self._get_server_information()
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in 
_get_server_information
self.server_charset = charset_by_id(lang).name
  File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
return self._by_id[id]
KeyError: 255

In file: C:\web2py\applications\ga\models\db.py

1.

 at 0AC93830, file 
"C:\web2py\applications\ga\models\db.py", line 8



This is my appconfig.ini:

; App configuration
[app]
name= Welcome
author  = Your Name 
description = a cool new app
keywords= web2py, python, framework
generator   = Web2py Web Framework

; Host configuration
[host]
names = localhost:*, 127.0.0.1:*, *:*, *

; db configuration
[db]
uri   = mysql://root:passwordroot@localhost/gadb?set_encoding=utf8mb4
migrate   = true
pool_size = 10 ; ignored for sqlite

; smtp address and credentials
[smtp]
server = smtp.gmail.com:587
sender = y...@gmail.com
login  = username:password
tls= true
ssl= true

; form styling
[forms]
formstyle = bootstrap3_inline
separator =

I just created the db "gadb" in mysql.exe. You can see the db, but I only 
created the db with the command

mysql> create database gadb; Query OK, 1 row affected (0.02 sec) mysql> 
show databases; ++ | Database | ++ 
| gadb | | information_schema | | mysql | | performance_schema | | sakila | 
| sys | | world | ++ 7 rows in 

[web2py] Re: In praise of the lowly "nested_select"

2019-02-13 Thread Skiros
Hello !
Very interesting !!!

I'm trying to reproduce this behaviour but I'm getting this error 
"Expression object has no attribute on". What version of w2p are you using ?

-- 
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: web2py dev env on chromebook?

2019-02-13 Thread Eliezer (Vlad) Tseytkin
I finally figured it out with crouton etc, but your way is much better.
I'll look into this sandbox thing; wasn't aware of it.
Thank you

On Wed, Feb 13, 2019, 10:46 AM  I use python/web2py on my chromebook without installing dev mode and
> without crouton etc, by using the linux shell sandbox that comes with more
> recent builds of ChromeOS.
>
> Just installing python and web2py into a venv was enough.
>
> On Thursday, 17 January 2019 01:30:42 UTC, Vlad wrote:
>>
>> If anybody has succeeded in setting up the dev env on chromebook I would
>> greatly appreciate some pointers.
>> I was able to get into dev mode and install linux on it, so linux is sort
>> of functional, but it's not complete. There is probably something specific
>> about chromebook, but I didn't find anything by googling it.
>> I simply want to have local web2py dev env on it... (My regular env is
>> windows; I am not too proficient in linux - if it works I can handle it,
>> but if something gets stuck, I don't know how to handle 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.


Re: [web2py] Re: Long text internationalization

2019-02-13 Thread Jon Subscripted
Thanks Dave,
For now I do not expect to go for pages long texts.
But still I'll take a look at how web2py-book is implemented.
Regards, Jon.

On Wed, Feb 13, 2019 at 12:39 AM Dave S  wrote:

>
>
> On Tuesday, February 12, 2019 at 3:57:36 AM UTC-8, Jonsubs wrote:
>>
>> Hi everyone,
>> Which is the common practice when facing long text internationalization?
>>
>> For instance, What should be done when you want to render a web page,
>> sharing a common layout, that has several paragraphs that must be
>> completelly translated?
>>
>> Based on the manual (
>> http://www.web2py.com/books/default/chapter/29/04/the-core#Internationalization-and-Pluralization-with-T
>> ) only string constants should be used with T. My guess is that large texts
>> should be treated differently.
>>
>> Thanks & Regards, Jon.
>>
>
>
> It looks like you're set for paragraphs of [previously] translated text.
> For really large pieces (pages long), you can take a look at how the web2py
> book does it:
> https://github.com/web2py/web2py-book>
> (just another web2py app, but the book content is in the sources
> sub-directory)
>
> Does Google Translate have an API?  If it does, that would probably be
> like using jQuery divs.
>
> FWIW, there's an interesting article (one of 3, it seems) about using a
> VPN to block app's from accessing Google resources;
>  https://gizmodo.com/i-cut-google-out-of-my-life-it-screwed-up-everything-1839565500
> >
> [It would certainly be hard to use this group for support if you blocked
> access to Google servers.]
> [[ Google controls 8,699,648 IP addresses, per the article]]
>
> /dps
>
> --
> 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: Update web2py manually

2019-02-13 Thread Константин Комков
It's test app which work on my computer and don't work on server. On server 
ajax return welcome page 

-- 
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.
# -*- coding: utf-8 -*-
def index():
form=DIV(
DIV(
DIV(
LABEL(
'Choose item:',
_for='item'
),
SELECT(
OPTION(
'',
_value=0
),
OPTION(
'question',
_value=1
),
OPTION(
'gratitude',
_value=0
),
OPTION(
'complaint',
_value=0
),
_class='form-control'
),
_class='col'
),
DIV(
BUTTON(
'Send',
_type='button',
_id='send',
_name='send',
_class='btn'
),
_class='col'
),
_class='row'
),
DIV(
DIV(
P(
_id='results'
),
_class='col'
),
_class='row'
),
_class='cotainer',
_name='myForm'
)
return dict(form=form)

def getRequest():
import json
a = json.loads(request.vars.data)
return XML('We got your message')
# -*- coding: utf-8 -*-
from gluon.contrib.appconfig import AppConfig
configuration = AppConfig(reload=True)
response.generic_patterns = ['*'] if request.is_local else []
response.formstyle = 'bootstrap3_inline'
response.form_label_separator = ''
Title: {{=response.title or request.application}}

  
  
  
{{include}}
  

{{extend 'layout.html'}}
{{=form}}