[web2py] Re: How many concurrent requests can a web2py instance handle?

2018-03-05 Thread nethugolol
Then one web2py instance can only handle one request, that's right?

-- 
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] Sending emial via smtp

2018-03-05 Thread Vikash Pandey


if I go to command line on python cell then this code works fine.


When I tested on python shell or on command line  (This code wors fine I can 
get email via gmial SMTP)


from gluon.tools import Mail

mail = Mail()
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'u...@gmail.com'

mail.settings.login = 'u...@gmail.com:password'

mail.send(to='v...@gmail.com', message='test')


But when I use this code in controller (default.py) then it does not work (I 
can not send email)!!! 


def test():

mail = Mail()
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'u...@gmail.com'

mail.settings.login = 'u...@gmail.com:password'

mail.send(to='v...@gmail.com', message='test')


I also tested with outlook.com same problem happend


Looking forwrd to hrer 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] mail send error via API

2018-03-05 Thread Vikash Pandey
on commad line or using python shell

This code works find and I can get email

from gluon.tools import Mail

# now we want to send email
mail = Mail()
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'v...@gmail.com'
mail.settings.login = 'v...@gmail.com:pass'

mail.send()

But in when controller default.py when i call fucntion 


def test():


mail = Mail()
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'v...@gmail.com'
mail.settings.login = 'v...@gmail.com:pass'

mail.send()


It does not work! I tested all the setting were same!!!


I do not know what is going wrong!!! 

-- 
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] Correct mySQL warning about NO_AUTO_CREATE_USER

2018-03-05 Thread 'Yan Wong' via web2py-users
A while ago I mentioned that running web2py with mySQL 5.7.7+ / pymysql 
gives the following warning:

/usr/local/lib/python2.7/site-packages/pymysql/cursors.py:165: Warning: 
(3090, u"Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be 
removed in a future release.")

I have tracked this down to line 56 
in gluon/packages/dal/pydal/adapters/mysql.py, which should have the 
NO_AUTO_CREATE_USER mode set 
(see 
https://dba.stackexchange.com/questions/120421/mysql-5-7-9-log-set-session-mode-gives-warning-about-no-auto-create-user-is-depr).
 
This is set in the recent pymysql files, such 
as pymysql/tests/test_connection.py (line 512/513)

self.execute("SET sql_mode='NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER';")

Can someone correct pydal/adapters/mysql.py?

Cheers

Yan

-- 
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: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-05 Thread 'Awe' via web2py-users
Hello Richard,
it is not a problem of deleted or changed records. As shown in the example, 
there is the table and versioning defined. After that 3 records are 
inserted and then the query is executed.
The defined query:
query = (test2.type_marker=='object') | (test2.type_marker==None) & 
(test1.type_marker=='person')
rows = current.db(query).select(test1.title, test2.title, left=test2.on(
test1.id==test2.granny))
does not give the right result.
I appreciate your help, maybe the problem gets easier to understand if you 
try to test the given example.
Many thanks,
Andreas


Am Montag, 5. März 2018 16:05:26 UTC+1 schrieb Richard:
>
> Did you set the actual record that have been deleted to is_active = 
> False?? Or all the records that haven't be deleted yet to TRUE?? You have 
> to go in your backend and do an update there
>
> UPDATE stored_item
> SET is_active = TRUE
>   WHERE is_active IS NULL
>
> If you didn't delete any record yet...
>
> You can also do it from web2py I guess with this command :
>
> db(db.stored_item.is_active == None).update(is_active=True)
> db.commit()
>
> Then you both query should return the same thing... Or at least they 
> should...
>
> It important to initialize archive table and parent table properly when 
> you add audit trail table to an already existing table containing record.
>
> I encourage you to read the book about record versioning : 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-versioning
>
> Richard
>
> On Sun, Mar 4, 2018 at 12:53 PM, 'Awe' via web2py-users <
> web...@googlegroups.com > wrote:
>
>> Hello Richard, many thanks for analyzing. Everything you wrote is 
>> completely right. But I still do not understand the behaviour explained 
>> before.
>> If you look at the table posted before, all is_acitve Flags are TRUE.
>> to get the result I need, I have defined:
>> query = (test2.type_marker=='object') | (test2.type_marker==None) & 
>> (test1.type_marker=='person')
>> rows = current.db(query).select(test1.title, test2.title, 
>> left=test2.on(test1.id==test2.granny))
>>
>> the raw sql of this query WITHOUT record versioning is fine.
>> SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN 
>> "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE 
>> (("test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) AND 
>> ("test1"."type_marker" = 'person')));
>> And the result is the way it suposed to be:
>>
>> test1.titletest2.title
>> PeterNone
>> PaulLaptop
>>
>> The result with record versioning enabled is different:
>> test1.titletest2.title
>> PaulLaptop
>>
>> Even when the is_acitve Field is defined like that:
>>
>> Field('is_active', 'boolean', writable=False, readable=False, 
>> default=True,required=True, requires=IS_NOT_EMPTY()),
>>
>> So maybe I miss something? At the moment I still wonder why the identical 
>> query comes to different results.
>>
>>
>> Best regards, an many thanks for your help!
>> Andreas
>>
>>
>>
>>
>>
>> Am Freitag, 2. März 2018 16:59:35 UTC+1 schrieb Richard:
>>>
>>> Hmmm... I think that if you have record versioning activated there 
>>> shouldn't be any is_active row(s) with NULL value... I mean is_active flag 
>>> is used to determine if the record in the "parent" table has been deleted 
>>> or not, since you can truely deleted in case you use record versioning 
>>> feature as all the previous record stated records contained in the 
>>> versioning table reference the parent record in the parent table...
>>>
>>> And you see in the second example here :
>>>
>>>
>>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=record+versioning#Record-versioning
>>>
>>> That is_active is set to default=True and there is this note :
>>>
>>> Notice the hidden boolean field called is_active and defaulting to True.
>>>
>>> So if you have activated record versioning feature over an already 
>>> existing table you need to set is_active to TRUE for all the existing 
>>> record once you start using the versioning feature and set the is_active to 
>>> be mandatory...
>>>
>>> I guess it would make sens to change seconde book example in orther that 
>>> is should be more obvious that is_active is mandatory like so :
>>>
>>> db.define_table('stored_item',
>>> Field('name'),
>>> Field('quantity', 'integer'),
>>> Field('is_active', 'boolean',
>>>   writable=False, readable=False, default=True, 
>>> required=True, requires=IS_NOT_EMPTY()))
>>>
>>>
>>>
>>> That way you don't need to care about null value to get all the records 
>>> of the parent table and DAL is not bugged...
>>>
>>> Richard
>>>
>>> On Fri, Mar 2, 2018 at 9:22 AM, 'Awe' via web2py-users <
>>> web...@googlegroups.com> wrote:
>>>
 So, I did check it again:

 It seems that DAL is not able to handle a left join using ISNULL 
 conditio

Re: [web2py] Re: please help us test trunk web2py

2018-03-05 Thread Richard Vézina
@pbreit, I think that if you clone recursive at start pull will be enough
to update you envrionement... You can assess which version of the pyDAL you
have once you pull, just go in gluon/packages/dal/CHANGES and check which
version is mention in the last change log there...

You can compare what is mention in web2py/CHANGELOG file... It appears to
be the only place where the link is establish about what is the given pyDAL
version that should be attached to a given version of web2py... I don't
find that very neat as if it got forgotten we don't have a proper way to
assess that we have the proper pyDAL version...

Richard

On Fri, Mar 2, 2018 at 1:56 PM, pbreit  wrote:

> Thanks. I've already cloned. But remained confused how to update
> correctly. Normally I would just "git pull" but am not sure if I need to do
> something else to make sure DAL updated, too.
>
> --
> 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: book help

2018-03-05 Thread Richard Vézina
Massimo has to push the merge stuff online once it get merge... If not
update is apply to the web site of the book even if change are merge they
still are not available...

Richard

On Sat, Mar 3, 2018 at 11:50 AM, villas  wrote:

> Where is the ASSIGNJS description in the book?
> In the Github repo for the book,  issue 369
>  was merged?
> Also, are we still waiting for ANY_OF too?
> Can someone who understands it,  please take a look.
> Many thanks!
>
>
>
> --
> 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: Unexpected behaviour executing a query with DAL and record versioning enabled

2018-03-05 Thread Richard Vézina
Did you set the actual record that have been deleted to is_active = False??
Or all the records that haven't be deleted yet to TRUE?? You have to go in
your backend and do an update there

UPDATE stored_item
SET is_active = TRUE
  WHERE is_active IS NULL

If you didn't delete any record yet...

You can also do it from web2py I guess with this command :

db(db.stored_item.is_active == None).update(is_active=True)
db.commit()

Then you both query should return the same thing... Or at least they
should...

It important to initialize archive table and parent table properly when you
add audit trail table to an already existing table containing record.

I encourage you to read the book about record versioning :
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-versioning

Richard

On Sun, Mar 4, 2018 at 12:53 PM, 'Awe' via web2py-users <
web2py@googlegroups.com> wrote:

> Hello Richard, many thanks for analyzing. Everything you wrote is
> completely right. But I still do not understand the behaviour explained
> before.
> If you look at the table posted before, all is_acitve Flags are TRUE.
> to get the result I need, I have defined:
> query = (test2.type_marker=='object') | (test2.type_marker==None) &
> (test1.type_marker=='person')
> rows = current.db(query).select(test1.title, test2.title,
> left=test2.on(test1.id==test2.granny))
>
> the raw sql of this query WITHOUT record versioning is fine.
> SELECT "test1"."title", "test2"."title" FROM "test" AS "test1" LEFT JOIN
> "test" AS "test2" ON ("test1"."id" = "test2"."granny") WHERE
> (("test2"."type_marker" = 'object') OR (("test2"."type_marker" IS NULL) AND
> ("test1"."type_marker" = 'person')));
> And the result is the way it suposed to be:
>
> test1.titletest2.title
> PeterNone
> PaulLaptop
>
> The result with record versioning enabled is different:
> test1.titletest2.title
> PaulLaptop
>
> Even when the is_acitve Field is defined like that:
>
> Field('is_active', 'boolean', writable=False, readable=False, 
> default=True,required=True, requires=IS_NOT_EMPTY()),
>
> So maybe I miss something? At the moment I still wonder why the identical 
> query comes to different results.
>
>
> Best regards, an many thanks for your help!
> Andreas
>
>
>
>
>
> Am Freitag, 2. März 2018 16:59:35 UTC+1 schrieb Richard:
>>
>> Hmmm... I think that if you have record versioning activated there
>> shouldn't be any is_active row(s) with NULL value... I mean is_active flag
>> is used to determine if the record in the "parent" table has been deleted
>> or not, since you can truely deleted in case you use record versioning
>> feature as all the previous record stated records contained in the
>> versioning table reference the parent record in the parent table...
>>
>> And you see in the second example here :
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-
>> abstraction-layer?search=record+versioning#Record-versioning
>>
>> That is_active is set to default=True and there is this note :
>>
>> Notice the hidden boolean field called is_active and defaulting to True.
>>
>> So if you have activated record versioning feature over an already
>> existing table you need to set is_active to TRUE for all the existing
>> record once you start using the versioning feature and set the is_active to
>> be mandatory...
>>
>> I guess it would make sens to change seconde book example in orther that
>> is should be more obvious that is_active is mandatory like so :
>>
>> db.define_table('stored_item',
>> Field('name'),
>> Field('quantity', 'integer'),
>> Field('is_active', 'boolean',
>>   writable=False, readable=False, default=True, 
>> required=True, requires=IS_NOT_EMPTY()))
>>
>>
>>
>> That way you don't need to care about null value to get all the records
>> of the parent table and DAL is not bugged...
>>
>> Richard
>>
>> On Fri, Mar 2, 2018 at 9:22 AM, 'Awe' via web2py-users <
>> web...@googlegroups.com> wrote:
>>
>>> So, I did check it again:
>>>
>>> It seems that DAL is not able to handle a left join using ISNULL
>>> condition in combination with enabled record versioning.
>>> There are two "is active" checks within the left join: OK
>>> The next two upcoming ANDs to check "is_active" are not necessary and
>>> actually prohibit the query to work properly.
>>> To make this work it should be: AND (("test1"."is_active" = 'T') AND
>>> (("test2"."is_active" = 'T' OR ("test2"."is_active" ISNULL ))
>>> The two AND is active checks at the end of the query are not necessary
>>> at all (my opinion).
>>>
>>> Could somebody please verifiy this!
>>> Andreas
>>>
>>>
>>> Am Donnerstag, 1. März 2018 13:37:59 UTC+1 schrieb Awe:

 Hello,
 I post a simple step by step example, to explain.
 Doing a left join and using a where clause like: table.field==None
 Depending on _enable_record_versioning is enabled or not, 

[web2py] I need little help about SQLForm.smartgrid and Models

2018-03-05 Thread Esprit Garonne
Hi 
I have last version of web2py, I dont understand why  all  buttons don't 
showing.I have only text link. 

In my school project for city of Tours, I try to build this form with 
web2py, 
https://www.blablacar.fr/offer-seats/1
About "Etapes" to add city,I need really some advice,? Can I build it  with 
SQLFORM.factory? or JQUERY?
 I know, web2py is really powerfull, It is very hard to understand all 
concept in web2py 

Do I need to use list:string  ? 

Does my model in web2py is ok?
 
FREQUENCES=('Quotidien','Exceptionnel','Weekend','Samedi','Dimanche')
TYPE_TRAJETS=('Aller','Retour','Aller-Retour')
FUMEUR=('Oui','Non','Indifférent')
db.define_table(
't_trajets',
Field('membre_voiture_id','reference t_voitures'),
Field('lieu_depart_id','reference t_villes'),
Field('lieu_arrive_id',db.t_villes),
Field('depart_le','datetime'),

Field('frequence',requires=IS_IN_SET(FREQUENCES),default=FREQUENCES[0]),

Field('type',requires=IS_IN_SET(TYPE_TRAJETS),default=TYPE_TRAJETS[0]),

Field('fumeur',requires=IS_IN_SET(FUMEUR),default=FUMEUR[1]),
Field('commentaire','text'),
Field('prix','integer'),
Field( 'place_offert','integer'),
auth.signature
)
db.define_table('t_etapes_ville',
Field('trajet_id','reference t_trajets'),
Field('ville_id','reference t_villes'),
Field('ordre_depart','integer'),

   )
db.define_table('t_villes',
Field('dep', type='string', notnull=True,
  label=T('Département')),
Field('nom', type='string', notnull=True,
  label=T('ville')),
Field('code_postal', type='string', notnull=True,
  label=T('Code postal')),
Field('longitude_deg', type='float', notnull=True,
  label=T('Longitude')),
Field('latitude_deg', type='float', notnull=True,
  label=T('Latitude')),
format='%(nom)s %(code_postal)s'
   )
Many Thx

-- 
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: new style of welcome app

2018-03-05 Thread Anthony
On Sunday, March 4, 2018 at 12:12:45 PM UTC-5, Andrea Fae' wrote:
>
> I have different apps in my web2py environments. Web2py apps built before 
> a certain date have a stile with "login" link in the right upper side of 
> the web page, while the new apps, for example welcome app are with another 
> style with login link anchor in the left side, just after the menus, and 
> after a "search" box. Why?
> How to delete the search box and have the login in the right part of the 
> page?
>

You can copy the layout from the old welcome app if you prefer it. 
Otherwise, you'll have to customize the new layout to your liking. The 
search box is just 3 lines that you can delete. Regarding the login, it is 
already pushed to the right side of the screen.

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.


[web2py] Re: How many concurrent requests can a web2py instance handle?

2018-03-05 Thread Anthony
One request at a time per thread or process made available by the web 
server.

Anthony

On Saturday, March 3, 2018 at 12:26:06 AM UTC-5, nethugo...@gmail.com wrote:
>
> I know this is probably not a specific web2py issue, but rather a WSGI 
> one. I am somewhat confused. However, this is not the largely discussed 
> "Does web2py scale?" question.
>
> I am wondering if a single web2py instance can handle two or more requests 
> concurrently, or if two users access to the site at the same time, then one 
> request is queued up?
>
> I am deploying a site in PythonAnywhere for a small business, with 4 web 
> workers. I guess that means 4 web2py processes and that the webserver will 
> dispatch incoming requests to one idle process of those four?
>
> Thanks in advance!
>

-- 
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.