Re: [web2py] Re: query and json-field

2018-06-01 Thread Martin Weissenboeck
Hi Anthony!

Of course my exaple is very simplified and - sorry - I did not test it.
Now I have found the solution

I have written:

query1 = db.sendeprotokoll.typ=="UMF"
query1 &= *db*("extra->>'umfragetextid'='4'")
r1 = db(query1)._select("sendeprotokoll.typ", "sendeprotokoll.extra")

But it should be:

query2 = db.sendeprotokoll.typ=="UMF"
query2 &= "extra->>'umfragetextid'='4'"
r2 = db(query2)._select("sendeprotokoll.typ", "sendeprotokoll.extra")


query1 :
>'umfragetextid'='4'>)>
query2 :
>'umfragetextid'='4')>
r1 :
SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM
"sendeprotokoll" WHERE ((("sendeprotokoll"."typ" = 'UMF') AND >'umfragetextid'='4'>));
r2 :
SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM
"sendeprotokoll" WHERE ((("sendeprotokoll"."typ" = 'UMF') AND
extra->>'umfragetextid'='4'));

Ok, problem solved, thank you!

-

But there is another question.
I want to use the json-query alone:

query3 = "extra->>'umfragetextid'='4'"
r3 = db(query3)._select("sendeprotokoll.typ", "sendeprotokoll.extra")

r3: SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM
"sendeprotokoll" WHERE extra->>'umfragetextid'='4';

Looks good?

But with
r3 = db(query3).select("sendeprotokoll.typ", "sendeprotokoll.extra")
I get a new error message and it comes from  *dal/pydal/adapters/base.py*

Ticket ID

195.230.45.151.2018-06-01.14-28-47.268ac848-705b-4300-ae59-bdb12d065fa4
 cannot extract element from a scalarVersion
web2py™ Version 2.15.4-stable+timestamp.2017.09.02.04.02.22
Python Python 2.7.12: /usr/local/bin/uwsgi (prefix: /usr/local)

Function argument list

(self=, *args=('SELECT
"sendeprotokoll"."typ", "sendeprotokoll"endeprotokoll" WHERE
extra->>\'umfragetextid\'=\'4\';',), **kwargs={})
Code listing

407.
408.
409.
410.
411.
412.

413.
414.
415.
416.

def execute(self, *args, **kwargs):
command = self.filter_sql_command(args[0])
handlers = self._build_handlers_for_execution()
for handler in handlers:
handler.before_execute(command)
rv = self.cursor.execute(command, *args[1:], **kwargs)

for handler in handlers:
handler.after_execute(command)
return rv

Variables
rv undefined
self 
args ('SELECT "sendeprotokoll"."typ", "sendeprotokoll"endeprotokoll"
WHERE extra->>\'umfragetextid\'=\'4\';',)
self.cursor 
command 'SELECT "sendeprotokoll"."typ", "sendeprotokoll"endeprotokoll"
WHERE extra->>\'umfragetextid\'=\'4\';'
self.cursor.execute 
kwargs {}

What is wrong?





2018-05-31 23:14 GMT+02:00 Anthony :

> "
> Can you show your exact code? Here's what I get:
>
> >>> db('j->>"x" = 1')._select(db.j.id)
> 'SELECT "j"."id" FROM "j" WHERE j->>"x" = 1;'
>
> Anthony
>
> On Thursday, May 31, 2018 at 5:01:08 PM UTC-4, mweissen wrote:
>>
>> Let's say I have a table like
>> db.define_table("mytable", Field("j", "json"))
>> with some data like db.mytable.insert(j={"x":1})
>>
>> Now I want to find all records with x==1.
>> Of course
>> db(db.mytable.j["x"]==1)
>> does not work (but it would be fine).
>>
>> I have tried some queries like
>> db.mytable.j.like("%1%")
>> db('(j-->x)=1')
>>
>> but nothing did work. web2py creates always a sql-statement with
>>  WHERE X)=1>...
>>
>> Postgresql does not understand > syntax error at or near "<" Where does this "" come from?
>> Any ideas?
>>
>> Regards, Martin
>>
>> --
> 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: form fields

2018-06-01 Thread Andrea Fae'
I'm saying thank you Anthony another time...you find every time the right 
way...my compliments.

Tell me...in your opinion what is the best python guide/tutorial (for free 
or cheap money) to use? What do you suggest?
Have a good day.
Thank you!


Il giorno giovedì 31 maggio 2018 23:32:51 UTC+2, Anthony ha scritto:

> On Thursday, May 31, 2018 at 2:27:44 PM UTC-4, Andrea Fae' wrote:
>>
>> thanks Anthony. Could you give me simple example about second idea? It's 
>> noy possible to pass variables to a onvalidation funtion? i.e. onvalidation 
>> doesn't accept parameters...the problem is: how to make that object 
>> available to the onvalidation function?
>>
>
> record = db.mytable(1)
>
> def my_validation(form):
> [now access record, which has been defined in the parent scope]
>
> form =SQLFORM(...).process(onvalidation=my_validation)
>
> or:
>
> record = db.mytable(1)
>
> def my_validation(form, record):
> ...
>
> form = SQLFORM(...).process(onvalidation=lambda form: my_validation(
> form, record))
>
> Anthony
>

-- 
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: query and json-field

2018-06-01 Thread Anthony
Maybe something like 
this: 
http://clarkdave.net/2015/03/navigating-null-safety-with-json-and-postgresql/

Anthony

On Friday, June 1, 2018 at 8:44:21 AM UTC-4, mweissen wrote:
>
> Hi Anthony!
>
> Of course my exaple is very simplified and - sorry - I did not test it.
> Now I have found the solution
>
> I have written:
>
> query1 = db.sendeprotokoll.typ=="UMF"
> query1 &= *db*("extra->>'umfragetextid'='4'")
> r1 = db(query1)._select("sendeprotokoll.typ", "sendeprotokoll.extra")
>
> But it should be:
> 
> query2 = db.sendeprotokoll.typ=="UMF"
> query2 &= "extra->>'umfragetextid'='4'"
> r2 = db(query2)._select("sendeprotokoll.typ", "sendeprotokoll.extra")
>
>
> query1 : 
>  extra->>'umfragetextid'='4'>)>
> query2 : 
> >'umfragetextid'='4')>
> r1 : 
> SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM 
> "sendeprotokoll" WHERE ((("sendeprotokoll"."typ" = 'UMF') AND  extra->>'umfragetextid'='4'>));
> r2 : 
> SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM 
> "sendeprotokoll" WHERE ((("sendeprotokoll"."typ" = 'UMF') AND 
> extra->>'umfragetextid'='4'));
>
> Ok, problem solved, thank you!
>
> -
>
> But there is another question. 
> I want to use the json-query alone:
>
> query3 = "extra->>'umfragetextid'='4'"
> r3 = db(query3)._select("sendeprotokoll.typ", "sendeprotokoll.extra")
>
> r3: SELECT "sendeprotokoll"."typ", "sendeprotokoll"."extra" FROM 
> "sendeprotokoll" WHERE extra->>'umfragetextid'='4';
>
> Looks good?
>
> But with
> r3 = db(query3).select("sendeprotokoll.typ", "sendeprotokoll.extra")
> I get a new error message and it comes from  *dal/pydal/adapters/base.py* 
>
> Ticket ID
>
> 195.230.45.151.2018-06-01.14-28-47.268ac848-705b-4300-ae59-bdb12d065fa4
>  cannot extract element from a scalarVersion
> web2py™ Version 2.15.4-stable+timestamp.2017.09.02.04.02.22
> Python Python 2.7.12: /usr/local/bin/uwsgi (prefix: /usr/local)
>
> Function argument list
>
> (self=, *args=('SELECT 
> "sendeprotokoll"."typ", "sendeprotokoll"endeprotokoll" WHERE 
> extra->>\'umfragetextid\'=\'4\';',), **kwargs={})
> Code listing
>
> 407.
> 408.
> 409.
> 410.
> 411.
> 412.
>
> 413.
> 414.
> 415.
> 416.
>
> def execute(self, *args, **kwargs):
> command = self.filter_sql_command(args[0])
> handlers = self._build_handlers_for_execution()
> for handler in handlers:
> handler.before_execute(command)
> rv = self.cursor.execute(command, *args[1:], **kwargs)
>
> for handler in handlers:
> handler.after_execute(command)
> return rv
>
> Variables
> rv undefined
> self 
> args ('SELECT "sendeprotokoll"."typ", "sendeprotokoll"endeprotokoll" 
> WHERE extra->>\'umfragetextid\'=\'4\';',)
> self.cursor 
> command 'SELECT "sendeprotokoll"."typ", 
> "sendeprotokoll"endeprotokoll" WHERE extra->>\'umfragetextid\'=\'4\';'
> self.cursor.execute  object>
> kwargs {}
>
> What is wrong?
>
>
>
>
>
> 2018-05-31 23:14 GMT+02:00 Anthony:
>
>> ">
>> Can you show your exact code? Here's what I get:
>>
>> >>> db('j->>"x" = 1')._select(db.j.id)
>> 'SELECT "j"."id" FROM "j" WHERE j->>"x" = 1;'
>>
>> Anthony
>>
>> On Thursday, May 31, 2018 at 5:01:08 PM UTC-4, mweissen wrote:
>>>
>>> Let's say I have a table like
>>> db.define_table("mytable", Field("j", "json"))
>>> with some data like db.mytable.insert(j={"x":1})
>>>
>>> Now I want to find all records with x==1.
>>> Of course
>>> db(db.mytable.j["x"]==1)
>>> does not work (but it would be fine).
>>>
>>> I have tried some queries like
>>> db.mytable.j.like("%1%")
>>> db('(j-->x)=1')
>>>
>>> but nothing did work. web2py creates always a sql-statement with
>>>  WHERE X)=1>...
>>>
>>> Postgresql does not understand >> syntax error at or near "<" Where does this "" come from?
>>> Any ideas?
>>>
>>> Regards, Martin
>>>
>>> -- 
>> 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] COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL

2018-06-01 Thread Junior Phanter
how set COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL?

When I am ordering sharp words, I want him to ignore the accents. I was
saving using compute field, names without accent and uppercase to be able
to sort, but then db size increases, an alternative would be to sort ()
doing this change in execution, but in this way I lose performance and
practicality, so wanted to know if you have set COLLATE UNICODE or COLLATE
LOCALIZED using DAL. That is, the DAL generates the following SQL:

SELECT * FROM foo ORDER BY to COLLATE UNICODE

-- 
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: COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL

2018-06-01 Thread Anthony
You can execute arbitrary SQL via db.executesql(), but I don't think there 
is an easy way to add the collate expression to a standard DAL-generated 
query (you could generate a SQL string via the ._select() method and then 
manipulate it and ultimately pass it to db.executesql()).

Would it make more sense to define the collation behavior of the column 
directly in the SQLite schema so you don't have to worry about specifying 
it on a per-query basis (or do you sometimes want different collation 
behavior for this particular column)?

Anthony

On Friday, June 1, 2018 at 11:43:45 AM UTC-4, Junior Phanter wrote:
>
> how set COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL?
>
> When I am ordering sharp words, I want him to ignore the accents. I was 
> saving using compute field, names without accent and uppercase to be able 
> to sort, but then db size increases, an alternative would be to sort () 
> doing this change in execution, but in this way I lose performance and 
> practicality, so wanted to know if you have set COLLATE UNICODE or 
> COLLATE LOCALIZED using DAL. That is, the DAL generates the following SQL:
>
> SELECT * FROM foo ORDER BY to COLLATE UNICODE 
>

-- 
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: COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL

2018-06-01 Thread Junior Phanter
 Thank you Antony. I'm trying to use executesql.

2018-06-01 13:04 GMT-03:00 Anthony :

> You can execute arbitrary SQL via db.executesql(), but I don't think there
> is an easy way to add the collate expression to a standard DAL-generated
> query (you could generate a SQL string via the ._select() method and then
> manipulate it and ultimately pass it to db.executesql()).
>
> Would it make more sense to define the collation behavior of the column
> directly in the SQLite schema so you don't have to worry about specifying
> it on a per-query basis (or do you sometimes want different collation
> behavior for this particular column)?
>
> Anthony
>
>
> On Friday, June 1, 2018 at 11:43:45 AM UTC-4, Junior Phanter wrote:
>>
>> how set COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL?
>>
>> When I am ordering sharp words, I want him to ignore the accents. I was
>> saving using compute field, names without accent and uppercase to be able
>> to sort, but then db size increases, an alternative would be to sort ()
>> doing this change in execution, but in this way I lose performance and
>> practicality, so wanted to know if you have set COLLATE UNICODE or
>> COLLATE LOCALIZED using DAL. That is, the DAL generates the following
>> SQL:
>>
>> SELECT * FROM foo ORDER BY to COLLATE UNICODE
>>
> --
> 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: COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL

2018-06-01 Thread Junior Phanter
 The best solution using SQLITE that I found for my problem
https://stackoverflow.com/questions/5492508/ignore-accents-sqlite3

2018-06-01 13:53 GMT-03:00 Junior Phanter :

> Thank you Antony. I'm trying to use executesql.
>
> 2018-06-01 13:04 GMT-03:00 Anthony :
>
>> You can execute arbitrary SQL via db.executesql(), but I don't think
>> there is an easy way to add the collate expression to a standard
>> DAL-generated query (you could generate a SQL string via the ._select()
>> method and then manipulate it and ultimately pass it to db.executesql()).
>>
>> Would it make more sense to define the collation behavior of the column
>> directly in the SQLite schema so you don't have to worry about specifying
>> it on a per-query basis (or do you sometimes want different collation
>> behavior for this particular column)?
>>
>> Anthony
>>
>>
>> On Friday, June 1, 2018 at 11:43:45 AM UTC-4, Junior Phanter wrote:
>>>
>>> how set COLLATE UNICODE or COLLATE LOCALIZED in sqlite using DAL?
>>>
>>> When I am ordering sharp words, I want him to ignore the accents. I was
>>> saving using compute field, names without accent and uppercase to be able
>>> to sort, but then db size increases, an alternative would be to sort ()
>>> doing this change in execution, but in this way I lose performance and
>>> practicality, so wanted to know if you have set COLLATE UNICODE or
>>> COLLATE LOCALIZED using DAL. That is, the DAL generates the following
>>> SQL:
>>>
>>> SELECT * FROM foo ORDER BY to COLLATE UNICODE
>>>
>> --
>> 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: legacy database : extract database models

2018-06-01 Thread Massimo Di Pierro
If the table exists than:

legacy_db = DAL('sqlite://mutualfunds.sqlite', migrate_enabled = True, 
fake_migrate_all = True)

will create the metadata. if both table and metadata exist than:

legacy_db = DAL('sqlite://mutualfunds.sqlite', migrate_enabled = False)

should successfully connect

if the table does not exist (not your case), then

legacy_db = DAL('sqlite://mutualfunds.sqlite', migrate_enabled = True)

will create.

On Wednesday, 9 May 2018 05:38:45 UTC-5, 黄祥 wrote:
>
> tryin to learn extract database models, all database is generated from 
> web2py app, then create new web2py app named test1, copy the database 
> (sqlite) to test1 databases folder, for mysql test is remaining from 
> another web2py app
> *sqlite using terminal*
> python ~/web2py/scripts/extract_sqlite_models.py 
> ~/web2py/applications/test1/databases/test1.sqlite
>
> *result in terminal (cutted)*
> legacy_db = DAL('sqlite://mutualfunds.sqlite')
> legacy_db.define_table('auth_user',
> migrate=False)
>
> *mysql using terminal*
> python ~/web2py/scripts/extract_mysql_models.py root:@localhost/test1
>
> *result in terminal (cutted)*
> legacy_db = DAL('mysql://root:@localhost/test1')
> legacy_db.define_table('auth_user',
> Field('id','integer'),
> Field('first_name','string'),
> Field('last_name','string'),
> Field('email','string'),
> Field('username','string'),
> Field('password','string'),
> Field('registration_key','string'),
> Field('reset_password_key','string'),
> Field('registration_id','string'),
> Field('is_active','string'),
> Field('created_on','datetime'),
> Field('created_by','integer'),
> Field('modified_on','datetime'),
> Field('modified_by','integer'),
> Field('created_from','string'),
> Field('modified_from','string'),
> migrate=False)
>
> *question:*
> - why the result is different in define_table (sqlite and mysql)? can we 
> define the table without defining it's own field like sqlite result ?
> - there are an error traceback with the dal constructor, seems must have 
> migrate=False or anything, even try at the define table add the migrate 
> parameter still meet the error traceback
> *e.g.1*
> legacy_db = DAL('sqlite://mutualfunds.sqlite')
>
> *error traceback:*
> Traceback (most recent call last):
>   File "/Users/MacBookPro/project/python/web2py/gluon/restricted.py", line 
> 219, in restricted
> exec(ccode, environment)
>   File 
> "/Users/MacBookPro/project/python/web2py/applications/test/models/db.py", 
> line 75, in 
> auth.define_tables(username=False, signature=False)
>   File "/Users/MacBookPro/project/python/web2py/gluon/tools.py", line 
> 2216, in define_tables
> super(Auth, self).define_tables(username, signature, migrate, 
> fake_migrate)._table_signature_list
>   File "/Users/MacBookPro/project/python/web2py/gluon/authapi.py", line 
> 350, in define_tables
> format='%(first_name)s %(last_name)s (%(id)s)'))
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 586, in define_table
> table = self.lazy_define_table(tablename, *fields, **args)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 620, in lazy_define_table
> polymodel=polymodel)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  
> line 797, in create_table
> return self.migrator.create_table(*args, **kwargs)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/migrator.py",
>  
> line 277, in create_table
> self.adapter.create_sequence_and_triggers(query, table)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  
> line 880, in create_sequence_and_triggers
> self.execute(query)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/adapters/__init__.py",
>  
> line 67, in wrap
> return f(*args, **kwargs)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/adapters/base.py",
>  
> line 412, in execute
> rv = self.cursor.execute(command, *args[1:], **kwargs)
> OperationalError: table "auth_user" already exists
>
> *e.g.2*
> legacy_db = DAL('sqlite://mutualfunds.sqlite', migrate = False, 
> fake_migrate = False, migrate_enabled = False, fake_migrate_all = False)
>
> *error traceback:*
> Traceback (most recent call last):
>   File "/Users/MacBookPro/project/python/web2py/gluon/restricted.py", line 
> 219, in restricted
> exec(ccode, environment)
>   File 
> "/Users/MacBookPro/project/python/web2py/applications/test/models/table.py", 
> line 3, in 
> migrate = True, fake_migrate = True, migrate_enabled = True, 
> fake_migrate_all = True)
>   File 
> "/Users/MacBookPro/project/python/web2py/gluon/packages/dal/pydal/base.py", 
> line 571, in define_table
> raise SyntaxError('table already defined: %s' % tablename)
> SyntaxError: table already defined: auth_user
>
>

[web2py] Re: sending html emails.... bug ...

2018-06-01 Thread Massimo Di Pierro
Very strange. Can you show us the code to generate the email and the html 
in the email?

On Wednesday, 16 May 2018 11:14:55 UTC-5, Ramos wrote:
>
> Hello i´m sending html emails but some clients for example google have an 
> issue with images
>
> Google is showing this code for the original html email...
>
> https://www.iol.pt"; target=*3D*"_blank">
>
> instead of 
> https://www.iol.pt"; target="_blank">
>
> what could be the issue with *3D  ???*
>
> 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.


[web2py] Re: European General data protection act and web2py

2018-06-01 Thread Massimo Di Pierro
yes. web2py uses cookies by default for sessions.

On Friday, 18 May 2018 02:40:58 UTC-5, BlueShadow wrote:
>
> Hi,
> I am using a fairly old version of web2py since the page is running since 
> 2012 I haven't done many updates. (since I ran into a world of trouble last 
> time I tried to upgrade it I stayed at version 2.14.6)
>
> Can you tell me if the web2py is using cookies?
> Has anyone a cookie warning implemented or any other thing.
> what would be the least anoying way to implement 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.


[web2py] remove seconds from datetime picker

2018-06-01 Thread Andrea Fae'
When I select from standard calendar a datetime value it adds :00 seconds! 
But I don't want, I don't need. How to remove from the datetime field?
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: legacy database : extract database models

2018-06-01 Thread 黄祥
not sure if this correlated with error traceback:
auth.define_tables(...) 
perhaps should comment auth.define_tables() when using legacy table

but for the extract_sqlite_models.py will have an empty result (no table 
fields defined for all of the tables), solution for now is to use the 
extract_mysql_models.py or extract_pgsql_models.py
*e.g. postgresql*
source activate python2_test
pip install psycopg2
python /Users/sugizo/web2py/scripts/extract_pgsql_models.py db_name 
localhost 5432 db_user db_pass

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.