[web2py] Re: How to retain the 'email verification' functionality in customized registration form?

2020-07-01 Thread Scott Hunter
Then you need to change something.  Since you haven't shown *anything* of 
what you've written, no one can help with what that change might be.

On Wednesday, July 1, 2020 at 1:00:06 AM UTC-4, Anusha Narayan wrote:
>
> when I am trying to style the registration form using HTML, I am losing 
> the functionality of "email verification" when I click SIGN UP button.
> The form is not responding in an appropriate manner.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dda7d238-7b2d-46ba-8cd1-ee4682e13983o%40googlegroups.com.


[web2py] Re: Column auth_user.id not found BUT the column exists.

2020-06-27 Thread Scott Hunter
Can you post the complete instructions for the lines listed in the stack 
trace?  At least for the one in your code?

On Tuesday, June 23, 2020 at 10:10:32 AM UTC-4, Diego Tostes wrote:
>
>
> I am getting this error:
>
> Traceback (most recent call last):
>   File "/home/rebec/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/rebec/web2py/applications/lavanderia/views/appadmin.html" 
> , line 169, in 
> 
> dict( ratio=ram['ratio'], hits=ram['hits'], misses=ram['misses']))}}
>   File "/home/rebec/web2py/gluon/sqlhtml.py", line 3274, in __init__
> "Column %s not found (SQLTABLE)" % colname)
> KeyError: 'Column auth_user.id not found (SQLTABLE)'
>
>
> But when i check the DB:
>
> mysql> show columns in 
> auth_user;++--+--+-+-++|
>  Field  | Type | Null | Key | Default | Extra  
> |++--+--+-+-++|
>  id | int(11)  | NO   | PRI | NULL| auto_increment || 
> first_name | varchar(128) | YES  | | NULL||| 
> last_name  | varchar(128) | YES  | | NULL||| 
> email  | varchar(512) | YES  | | NULL||| 
> password   | varchar(512) | YES  | | NULL||| 
> registration_key   | varchar(512) | YES  | | NULL||| 
> reset_password_key | varchar(512) | YES  | | NULL||| 
> registration_id| varchar(512) | YES  | | NULL|
> |++--+--+-+-++8
>  rows in set (0.00 sec)
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ceb32c69-2363-4ee0-a32c-8cceaa975e83o%40googlegroups.com.


[web2py] Re: CON Abandoned framework with (almost) no community

2020-05-18 Thread Scott Hunter
One constructive way to counter this "argument" might be to contribute a 
web2py entry (frontend and/or backend) 
to https://github.com/gothinkster/realworld

On Sunday, May 17, 2020 at 5:10:31 PM UTC-4, Ramos wrote:
>
> How is that possible ?
> https://www.slant.co/versus/1397/1746/~web2py_vs_django  
> I´m here and many others are here...
> Who is trying to make us look like dead people ??
>
> Regards to you all :)
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/93df7ffa-ecd0-463c-b329-69e2c38e9c00%40googlegroups.com.


[web2py] Re: web2py - date picker issue

2020-05-06 Thread Scott Hunter
Please identify what part of this rather long file is relevant to your 
question.  You might also want to look at the documentation for SQLFORM 
with regard ti how to use keepvalues.

On Wednesday, May 6, 2020 at 9:44:37 AM UTC-4, Anuj Mahawar wrote:
>
> Yes, its part of the SQLFORM. I have attached my file from the controller. 
> Could you please let me know where do I need to make the changes (i.e. 
> keepvalues = True)
>
> Regards,
> Anuj
>
> On Tuesday, May 5, 2020 at 6:38:29 PM UTC+5:30, Scott Hunter wrote:
>>
>> If this is part of a form (which I have to guess at, since you have 
>> provided *no* details), you can use the `keepvalues` option to not reset 
>> the fields of a form.
>>
>> On Tuesday, May 5, 2020 at 8:24:32 AM UTC-4, Anuj Mahawar wrote:
>>>
>>> Hey Scott, 
>>> Yeah, I meant that the date is resetting to the current date even though 
>>> I am selecting any previous date. Do you have any suggestions to change 
>>> this default behavior?
>>>
>>> On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote:
>>>>
>>>> What do you mean by "redirected"?  If you just mean that the date field 
>>>> is reset to the current date, that is the same default behavior for all 
>>>> input fields.
>>>>
>>>> On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote:
>>>>>
>>>>> I am a beginner to the web2py. I am building an application with a 
>>>>> date picker on the home page. The issue is - Whenever I try to edit a 
>>>>> previous day's record and submit, instead of on being on the same date, 
>>>>> it 
>>>>> is being redirected to the current date page. e.g. suppose I have logged 
>>>>> in 
>>>>> and it displays the current date i.e. 29 April 2020. When I try to edit a 
>>>>> record for 01 April 2020 and submit the entry, it is being redirected to 
>>>>> the current date i.e. 29 April 2020. Any idea why the application is 
>>>>> behaving like that?
>>>>>
>>>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d77ee4d0-7c07-42db-bd9c-3715e947b935%40googlegroups.com.


[web2py] Re: web2py - date picker issue

2020-05-05 Thread Scott Hunter
If this is part of a form (which I have to guess at, since you have 
provided *no* details), you can use the `keepvalues` option to not reset 
the fields of a form.

On Tuesday, May 5, 2020 at 8:24:32 AM UTC-4, Anuj Mahawar wrote:
>
> Hey Scott, 
> Yeah, I meant that the date is resetting to the current date even though I 
> am selecting any previous date. Do you have any suggestions to change this 
> default behavior?
>
> On Tuesday, May 5, 2020 at 5:22:30 PM UTC+5:30, Scott Hunter wrote:
>>
>> What do you mean by "redirected"?  If you just mean that the date field 
>> is reset to the current date, that is the same default behavior for all 
>> input fields.
>>
>> On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote:
>>>
>>> I am a beginner to the web2py. I am building an application with a date 
>>> picker on the home page. The issue is - Whenever I try to edit a previous 
>>> day's record and submit, instead of on being on the same date, it is being 
>>> redirected to the current date page. e.g. suppose I have logged in and it 
>>> displays the current date i.e. 29 April 2020. When I try to edit a record 
>>> for 01 April 2020 and submit the entry, it is being redirected to the 
>>> current date i.e. 29 April 2020. Any idea why the application is behaving 
>>> like that?
>>>
>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2c1f0cb7-0ba7-4f3b-a54b-bdc2d3f5ead1%40googlegroups.com.


[web2py] Re: web2py - date picker issue

2020-05-05 Thread Scott Hunter
What do you mean by "redirected"?  If you just mean that the date field is 
reset to the current date, that is the same default behavior for all input 
fields.

On Tuesday, May 5, 2020 at 12:44:31 AM UTC-4, Anuj Mahawar wrote:
>
> I am a beginner to the web2py. I am building an application with a date 
> picker on the home page. The issue is - Whenever I try to edit a previous 
> day's record and submit, instead of on being on the same date, it is being 
> redirected to the current date page. e.g. suppose I have logged in and it 
> displays the current date i.e. 29 April 2020. When I try to edit a record 
> for 01 April 2020 and submit the entry, it is being redirected to the 
> current date i.e. 29 April 2020. Any idea why the application is behaving 
> like that?
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f7e96af3-d922-4f51-aab4-3bcf0d9d4fcf%40googlegroups.com.


Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Would this do the job?

form = SQLFORM.factory(*fields)
if form.process().accepted:
#  update the database here
form2 = SQLFORM.factory(*fields)
form2.vars['state'] = form.vars.state
form2.process()
else:
form2 = form

return dict(form=form2)



On Thursday, April 30, 2020 at 2:06:46 PM UTC-4, Jim S wrote:
>
> Here is what I'm talking about:
>
> def update_something():
> fields = [Field('name'),
>   Field('address', 'text'),
>   Field('city'),
>   Field('state'),
>   Field('zip_code')]
>
> form = SQLFORM.factory(*fields)
>
> if form.process().accepted:
> #  update the database here
>
> return dict(form=form)
>
> After the first time a user updates a record, I want the value of 'state' 
> to remain and everything else go back to the defaults.  I know I can do it 
> by adding some code after form.process().accepted to save the value to the 
> session, and then check it before defining the fields, but 'form' doesn't 
> exist yet.
>
> I still think I must be missing something here....
>
> -Jim
>
>
> On Thursday, April 30, 2020 at 12:30:44 PM UTC-5, Scott Hunter wrote:
>>
>> Isn't "the next time through the method" when there is a new submission, 
>> which would have the saved value in it (unless the user changed it)?  Maybe 
>> a sample of your code would make things clearer.
>>
>> On Thursday, April 30, 2020 at 1:21:53 PM UTC-4, Jim S wrote:
>>>
>>> Yes, but I need that value on the next time through the method.  
>>> Therefore I have to save it to my session and grab it the next time in.  Am 
>>> I missing something?
>>>
>>> On Thu, Apr 30, 2020 at 12:19 PM Scott Hunter  
>>> wrote:
>>>
>>>> Since the value in question is part of the current submission, isn't 
>>>> the value available in form.vars?
>>>>
>>>> - Scott
>>>>
>>>> On Thursday, April 30, 2020 at 12:54:02 PM UTC-4, Jim S wrote:
>>>>>
>>>>> I was hoping to avoid those tricks.  I too have done this by storing 
>>>>> values in the session to be redisplayed.  I was hoping that the keepopts 
>>>>> argument to SQLFORM would allow you to specify which fields to keep, but 
>>>>> it 
>>>>> seems that is used for something else.
>>>>>
>>>>> On Thu, Apr 30, 2020 at 11:48 AM Scott Hunter  
>>>>> wrote:
>>>>>
>>>>>> I recall doing this by "pre-populating" the field you want to keep 
>>>>>> with the old value.
>>>>>>
>>>>>> - Scott
>>>>>>
>>>>>> On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote:
>>>>>>>
>>>>>>> Does anyone know how I can have a form 'keepvalues' but only keep 
>>>>>>> one specific field value?  I don't want it to keep the values for all 
>>>>>>> the 
>>>>>>> fields, just for the one specific field.
>>>>>>>
>>>>>>> Anyone tried this before?
>>>>>>>
>>>>>>> -Jim
>>>>>>>
>>>>>> -- 
>>>>>> 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/tgTvG8OqWso/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>>> web...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Isn't "the next time through the method" when there is a new submission, 
which would have the saved value in it (unless the user changed it)?  Maybe 
a sample of your code would make things clearer.

On Thursday, April 30, 2020 at 1:21:53 PM UTC-4, Jim S wrote:
>
> Yes, but I need that value on the next time through the method.  Therefore 
> I have to save it to my session and grab it the next time in.  Am I missing 
> something?
>
> On Thu, Apr 30, 2020 at 12:19 PM Scott Hunter  > wrote:
>
>> Since the value in question is part of the current submission, isn't the 
>> value available in form.vars?
>>
>> - Scott
>>
>> On Thursday, April 30, 2020 at 12:54:02 PM UTC-4, Jim S wrote:
>>>
>>> I was hoping to avoid those tricks.  I too have done this by storing 
>>> values in the session to be redisplayed.  I was hoping that the keepopts 
>>> argument to SQLFORM would allow you to specify which fields to keep, but it 
>>> seems that is used for something else.
>>>
>>> On Thu, Apr 30, 2020 at 11:48 AM Scott Hunter  
>>> wrote:
>>>
>>>> I recall doing this by "pre-populating" the field you want to keep with 
>>>> the old value.
>>>>
>>>> - Scott
>>>>
>>>> On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote:
>>>>>
>>>>> Does anyone know how I can have a form 'keepvalues' but only keep one 
>>>>> specific field value?  I don't want it to keep the values for all the 
>>>>> fields, just for the one specific field.
>>>>>
>>>>> Anyone tried this before?
>>>>>
>>>>> -Jim
>>>>>
>>>> -- 
>>>> 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/tgTvG8OqWso/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> web...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> -- 
>> 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/tgTvG8OqWso/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/14c77d74-1910-4b05-9b88-fac8bef5cf05%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/14c77d74-1910-4b05-9b88-fac8bef5cf05%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d9da4ea0-0166-49a5-b83d-658c1998a8ba%40googlegroups.com.


Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Since the value in question is part of the current submission, isn't the 
value available in form.vars?

- Scott

On Thursday, April 30, 2020 at 12:54:02 PM UTC-4, Jim S wrote:
>
> I was hoping to avoid those tricks.  I too have done this by storing 
> values in the session to be redisplayed.  I was hoping that the keepopts 
> argument to SQLFORM would allow you to specify which fields to keep, but it 
> seems that is used for something else.
>
> On Thu, Apr 30, 2020 at 11:48 AM Scott Hunter  > wrote:
>
>> I recall doing this by "pre-populating" the field you want to keep with 
>> the old value.
>>
>> - Scott
>>
>> On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote:
>>>
>>> Does anyone know how I can have a form 'keepvalues' but only keep one 
>>> specific field value?  I don't want it to keep the values for all the 
>>> fields, just for the one specific field.
>>>
>>> Anyone tried this before?
>>>
>>> -Jim
>>>
>> -- 
>> 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/tgTvG8OqWso/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/14c77d74-1910-4b05-9b88-fac8bef5cf05%40googlegroups.com.


[web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
I recall doing this by "pre-populating" the field you want to keep with the 
old value.

- Scott

On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote:
>
> Does anyone know how I can have a form 'keepvalues' but only keep one 
> specific field value?  I don't want it to keep the values for all the 
> fields, just for the one specific field.
>
> Anyone tried this before?
>
> -Jim
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b4575285-7562-4a55-9470-0adfcbe354f1%40googlegroups.com.


Re: [web2py] Re: p4web auth issues

2020-02-23 Thread Scott Hunter
user = auth.get.user()['first_name']

On Sunday, February 23, 2020 at 9:23:06 PM UTC-5, Lovedie JC wrote:
>
> Thanks.
> Before you replied I had tried :
> user = auth.get.user()[first_name]
>
> With an error.. 'first_name' is not defined
> Regards 
>
> On Mon, Feb 24, 2020, 02:02 Val K > wrote:
>
>> `auth` in py4web is no the same as in web2py
>> to get user-record you should
>> ...
>> def index():
>> user = auth.get_user()
>>
>>
>>
>> On Sunday, February 23, 2020 at 8:47:46 PM UTC+3, Maurice Waka wrote:
>>>
>>>
>>> import os
>>> import datetime as dt
>>> from datetime import datetime, timedelta, date 
>>> from .common import db, session, T, cache, auth, logger, authenticated, 
>>> unauthenticated
>>> from py4web import action, request, DAL, Field, Session, Cache, user_in, 
>>> abort, redirect, URL, Field
>>> from py4web.utils.auth import Auth
>>> from py4web import action, request, abort, redirect, URL, Field
>>> from py4web.utils.form import Form, FormStyleBulma
>>> from py4web.utils.publisher import Publisher, ALLOW_ALL_POLICY
>>> from pydal.validators import IS_NOT_EMPTY, IS_INT_IN_RANGE, IS_IN_SET, 
>>> IS_IN_DB, IS_EMAIL, IS_MATCH
>>> from yatl.helpers import INPUT, H1, HTML, BODY, A
>>> from pydal.validators import *
>>>
>>> db.define_table('answers',
>>> Field('author', 'reference auth_user', 
>>> default=auth.user_id, readable=False, writable=False),
>>> Field('userId','reference 
>>> auth_user',unique=True,readable=False,writable=False),
>>> Field('quest', 'text', requires=IS_NOT_EMPTY(),),
>>> auth.signature
>>> )
>>> db.define_table('posts',
>>> Field('author', 'reference auth_user', 
>>> default=auth.user_id, writable=False, readable=False),
>>> Field("message", 'text', requires=IS_NOT_EMPTY(), 
>>> notnull=False),
>>> auth.signature
>>> )
>>>
>>> @authenticated()
>>> def index():
>>> codes = []
>>> del codes[:]
>>> r = []
>>> yesterday = dt.datetime.utcnow() - dt.timedelta(days=1)
>>> db(db.answers.modified_on < yesterday).delete()
>>> """Avoid an empty table"""
>>> user = db(db.posts.author== auth.user_id).select(db.posts.id, 
>>> db.posts.author, orderby=~db.posts.id, limitby=(0,1)).first()
>>> if user.author if user else None == auth.user_id:
>>> pass
>>> else:
>>> db.posts.insert(message="Welcome "+auth_user.first_name+'.'+' 
>>> Thank you for signing in with us. Blah blah blah.', author=auth.user_id, 
>>> created_by=auth.user_id, modified_by=auth.user_id)
>>> db.commit()
>>> On Sunday, February 23, 2020 at 8:28:28 PM UTC+3, Val K wrote:

 Show your code, please
>>>
>>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/19c4dd56-ffc3-40bb-9067-e5525ffafcf7%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/25dfd7d0-f876-4e97-a3ba-ff06a1415cba%40googlegroups.com.


[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread Scott Hunter
What error did it give you?  Are you sure `details.email_address` is 
defined?

On Sunday, February 23, 2020 at 8:13:07 AM UTC-5, mostwanted wrote:
>
> I did try  it without the quotes & it still gave me an error!
>
> On Sunday, February 23, 2020 at 2:59:04 PM UTC+2, Scott Hunter wrote:
>>
>> Did you try removing the quotes around the address?
>>
>> - Scott
>>
>>
>>
>> On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:
>>>
>>> I've created an emailing form in my application but have substituted 
>>> where the email goes with a reference that contains the email, the problem 
>>> is that now the email is not being sent unless i write a proper explicit 
>>> email address. Whats the difference between writing an explicit email 
>>> address & using a variable that supposedly contains the email? I have to 
>>> use the referencing variable as I currently am because different registered 
>>> users get to log in & send emails, its not just one user. How can I solve 
>>> this problem???
>>>
>>> *CODE*
>>> def contact_us():
>>> details=db.hotel_profile(request.args(0, cast=int))
>>> form = SQLFORM.factory(
>>> Field('name', requires=IS_NOT_EMPTY()),
>>> Field('cell_number', requires=IS_NOT_EMPTY()),
>>> Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
>>> IS_NOT_EMPTY() ]),
>>> Field('subject', requires=IS_NOT_EMPTY()),
>>> Field('message', requires=IS_NOT_EMPTY(), type='text')
>>> )
>>> if form.process().accepted:
>>> *mail.send(to='details.email_address', *
>>>   #subject='contact request from %(your_name)s 
>>> %(email)s'  % form.vars,
>>>   subject=form.vars.subject,
>>>   message = '%(message)s \nName: %(name)s \nEmail 
>>> Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
>>> response.flash = T('Thank you, your form was submitted')
>>> #redirect(URL('index'))
>>> return dict(form=form)
>>>
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/50d062b2-974d-4da5-b92f-581128489088%40googlegroups.com.


[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-23 Thread Scott Hunter
Did you try removing the quotes around the address?

- Scott



On Saturday, February 22, 2020 at 4:56:04 PM UTC-5, mostwanted wrote:
>
> I've created an emailing form in my application but have substituted where 
> the email goes with a reference that contains the email, the problem is 
> that now the email is not being sent unless i write a proper explicit email 
> address. Whats the difference between writing an explicit email address & 
> using a variable that supposedly contains the email? I have to use the 
> referencing variable as I currently am because different registered users 
> get to log in & send emails, its not just one user. How can I solve this 
> problem???
>
> *CODE*
> def contact_us():
> details=db.hotel_profile(request.args(0, cast=int))
> form = SQLFORM.factory(
> Field('name', requires=IS_NOT_EMPTY()),
> Field('cell_number', requires=IS_NOT_EMPTY()),
> Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), 
> IS_NOT_EMPTY() ]),
> Field('subject', requires=IS_NOT_EMPTY()),
> Field('message', requires=IS_NOT_EMPTY(), type='text')
> )
> if form.process().accepted:
> *mail.send(to='details.email_address', *
>   #subject='contact request from %(your_name)s %(email)s' 
>  % form.vars,
>   subject=form.vars.subject,
>   message = '%(message)s \nName: %(name)s \nEmail 
> Address: %(email)s \nCell Number: %(cell_number)s' % form.vars)
> response.flash = T('Thank you, your form was submitted')
> #redirect(URL('index'))
> return dict(form=form)
>
>
> Regards;
>
> Mostwanted
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/83a9d596-48b5-49c5-b0fe-36f93ba792a1%40googlegroups.com.


[web2py] Re: Saving a view as an file/image

2020-01-26 Thread Scott Hunter
The FPDF module has an HTML Renderer which you might find useful.

- Scott

On Sunday, January 26, 2020 at 9:25:47 AM UTC-5, John Bannister wrote:
>
> Hi All,
>
> I have hit a bit of a stumbling block and would like to know if anyone 
> else has come across this and how to resolve it.
>
> Situation is as follows:-
>
> I am generating tickets/coupons for users once they have entered all the 
> appropriate info which I am doing via normal controller/view using html for 
> styling. Coupon consists of 2 images plus some text (nothing really fancy 
> at all).
>
> Everything looks okay and as it should in the view with all the correct 
> information etc.
>
> I now what to email the coupon to the user. This is where I am a bit 
> stumped.
>
> I am assuming that I will need to save the rendered view as an 
> image/file/.pdf if I want the styling, logos, qrcodes etc to be in the 
> email that I will send as well as for all the formatting to be as per the 
> view.
>
> Is there any easy way or any way at all to do this?
>
> In the controller I can use the response.render(view, args) but still cant 
> see how to create a pdf file from the actual view before sending the email.
> Hopefilly I ma missing something simple  
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2b28f316-57fd-4495-97b3-1d2e7b0dbc1e%40googlegroups.com.


[web2py] py4web won't create apps

2019-12-25 Thread Scott Hunter
I installed py4web via pip on a MacBook Pro running Catalina; it runs fine, 
and I can create new apps (by "hand"), but the dashboard & default apps 
don't get created, even if I run it with the -c flag.

I'd be happy to dig into *why*, since this does not seem to be a common 
problem, but would like some direction as to where to look.

- Scott

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f64adcc3-2b56-4bcb-a5a6-b7b850bbe09a%40googlegroups.com.


[web2py] Re: Off topic : visual diagrams anyone ???

2019-12-01 Thread Scott Hunter
What is stopping you from using it *in* your web2py app?

On Wednesday, November 27, 2019 at 12:58:48 PM UTC-5, Ramos wrote:
>
> Hard to find a tool like this for my web2py app
>
> https://mermaidjs.github.io/#/ 
>
>  
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a6b5dc62-e78b-47ff-a450-97ad0aafab95%40googlegroups.com.


[web2py] Re: validators

2019-11-04 Thread Scott Hunter
You could write one to do this & use it where you need to.

On Monday, November 4, 2019 at 12:00:47 AM UTC-5, T.R.Rajkumar wrote:
>
> sqlform filed validators do not check for the precision of decimal fields. 
> It would be nice it web2py validates the precision of fields.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6e181e57-ecf2-4d3f-9ba3-f6d6b2fde1d6%40googlegroups.com.


[web2py] Re: 'Storage' object is not callable

2019-07-09 Thread Scott Hunter
`post_vars` isn't callable, but you are trying to call it on line 7.  As 
I'm not sure what you are trying to do there, can't say what to do instead.


On Monday, July 8, 2019 at 11:13:21 PM UTC-4, imran tube wrote:
>
>  'Storage' object is not callable
> : where is my wrong my code view or controller or web2py problem ?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8633c2ce-47fc-4621-9877-7b3dd70f6d12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to pass the variable in Jquery in view to controller

2019-07-08 Thread Scott Hunter
The short answer is, you don't.  Javascript is being executed in the 
browser; controller code is executed on the server.

The longer answer is that the browser can make a request to the server (via 
ajax or some other mechanism) that can cause controller code to be 
executed.  I think you'll need to provide more details of what you are 
trying to do before someone can w/ details.

On Monday, July 8, 2019 at 5:45:29 PM UTC-4, Quang Lam wrote:
>
> Hi All, i would like to pass the variable clickedFlight in Jquery in view 
> to one of the functions named custom_view_search in view.py in controller. 
> Please show me how. Thanks
>
>
> $(document.body).on("contextmenu", "table tr", function(e) {
> var tableData = $(this).children("td").map(function(){
> return $(this).text();
> }).get();
> var clickedFlight = tableData[0]
> alert(clickedFlight);
> contextMenu.css({
>   display: "block",
>   left: e.clientX,
>   
>   //TODO: figure out why I have to hardcode this value to get 
> the menu to appear in correct place
>   //...Y axis page value not correctly displaying on table
>   top:  e.clientY - 80
>  }); 
>  return false;
>  
> });
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5257ab77-2e11-4824-b5b1-1876693d2034%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-05-12 Thread Scott Hunter
Note: if the folder, translations, that is being complained about is added, 
the app still can't be reached, but there is no longer an exception 
reported: just the 404 page.

- Scott

On Saturday, May 11, 2019 at 9:55:34 PM UTC-4, 黄祥 wrote:
>
> $ ./web3py-start applications/
> Dashboard is at: http://127.0.0.1:8000/_dashboard
> Traceback (most recent call last):
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 560, in 
> import_apps
> module = importlib.machinery.SourceFileLoader(app_name, init).
> load_module()
>   File "", line 407, in 
> _check_name_wrapper
>   File "", line 907, in load_module
>   File "", line 732, in load_module
>   File "", line 265, in _load_module_shim
>   File "", line 696, in _load
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in 
> _call_with_frames_removed
>   File 
> "/Users/sugizo/learn/python/web3py/applications/_dashboard/__init__.py", 
> line 12, in 
> T = Translator(T_FOLDER)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pluralize/__init__.py"
> , line 60, in __init__
> self.load(folder)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pluralize/__init__.py"
> , line 65, in load
> for filename in os.listdir(folder):
> FileNotFoundError: [Errno 2] No such file or directory: 
> '/Users/sugizo/learn/python/web3py/applications/_dashboard/translations'
>
> Traceback (most recent call last):
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 560, in 
> import_apps
> module = importlib.machinery.SourceFileLoader(app_name, init).
> load_module()
>   File "", line 407, in 
> _check_name_wrapper
>   File "", line 907, in load_module
>   File "", line 732, in load_module
>   File "", line 265, in _load_module_shim
>   File "", line 696, in _load
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/Users/sugizo/learn/python/web3py/applications/toys/__init__.py", 
> line 5, in 
> db = DAL('sqlite://storage.db', folder=os.path.join(os.path.dirname(
> __file__), 'databases'))
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py"
> , line 171, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py"
> , line 477, 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 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py"
> , line 457, in __init__
> self._adapter = adapter(**kwargs)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/__init__.py"
> , line 39, in __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 369, in __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 53, in __init__
> self.reconnect()
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/connection.py"
> , line 154, in reconnect
> self.connection = self.connector()
>   File 
> "/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/adapters/sqlite.py"
> , line 42, in connector
> return self.driver.Connection(self.dbpath, **self.driver_args)
> sqlite3.OperationalError: unable to open database file
>
> 127.0.0.1 - - [12/May/2019 08:44

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/956c3063-6f68-43c7-883f-e8af0f0e0294%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] pyDAL -> jsDAL?

2019-04-29 Thread Scott Hunter

The direction from web2py to web3py seems to be applications where the 
server is responsible for (relatively) static pages which use Javascript 
for their dynamic aspects & talking to the server via an API, primarily for 
interaction w/ the database.

In the spirit of Progressive Web Apps, one could imagine getting to the 
point where instead of making calls to the server, Javascript functions are 
called instead to interact w/ an SQLite DB under the browser's control. 
 Doing so via something like pyDAL, but replacing Python with Javascript & 
only needing to support SQLite would not only ease the burden of writing 
such code, but make it easier to make a transition between these two DB 
locations.

I'm actually thinking specifically of being able to deploy a pared-down 
version of a "normal" application which could perform most of its 
functionality off-line, and use online access only for transferring 
information in bulk between the local DB and the one in the cloud.  The 
more that those applications can share code, the better.  (I've 
accomplished this goal, somewhat clunkily, by deploying the web2py binary 
w/ a limited version of the app in the cloud; an approach as I've described 
above seems that it wouldn't be nearly as brittle.)

Does this make any sense?  Would something like a jsDAL be prohibitively 
difficult to write, or not really worth the effort?

-- 
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: Web3py

2019-04-23 Thread Scott Hunter
I followed these directions as best I could:

* There is no file named web3py.py.  There is a file web3py-start; that 
seemed to work
* No matter what URL I provide, I get a big red screen saying "404 Not 
Found"

On Thursday, April 11, 2019 at 1:31:29 PM UTC-4, En Ware wrote:
>
> I git installed web3py and quite enjoy it. I see its updated regular too. 
>
> For those who don't know and maybe this is common sense , not sure. 
>
> once you *git clone https://github.com/web2py/web3py.git 
>   *do a *git pull*
>
> 2. reinstall requirements.txt (*pip3 install -r requirements.txt*) 
>  - Changes:  module "reloader" was added 
>
> 3. Launch web3py (should work just fine now) 
>
> * python3 web3py.py applications/todo/*
>
> 4. open browser and type: * localhost:8000 or 127.0.0.1:8000 
> /todo/index*
>
>

-- 
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: Why python anywhere stuck with web2py 2.15 version

2019-04-01 Thread Scott Hunter
Shouldn't you ask them?

On Monday, April 1, 2019 at 8:57:21 AM UTC-4, Ron Chatterjee wrote:
>
> Does anyone know why python anywhere only give option for 2.15 edition of 
> web2py? If I have to guess that's few years old. I asked the question 
> because I am not sure if they believe 2.15 is more stable for 2.18. Is any 
> reason they use an older version of web2py?
>

-- 
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 can I convert a SUM from a SQLite SELECT statement to web2py's DAL?

2019-04-01 Thread Scott Hunter
This part of the web2py book might 
help: http://www.web2py.com/book/default/chapter/06#sum-avg-min-max-and-len

On Monday, April 1, 2019 at 6:41:51 PM UTC-4, João Matos wrote:
>
> Hello,
>
> I have this SELECT in SQLite
>
> result = db.executesql(
> "SELECT auth_user.id, auth_user.username, "
> "auth_user.canceled_on, "
> "auth_user.canceled_by, "
> "SUM(auth_group.role = 'Operador') operador, "
> "SUM(auth_group.role = 'Verificador') verificador, "
> "SUM(auth_group.role = 'Supervisor') supervisor "
> "FROM auth_user "
> "LEFT JOIN auth_membership ON auth_user.id = 
> auth_membership.user_id "
> "LEFT JOIN auth_group ON auth_group.id = 
> auth_membership.group_id "
> "GROUP BY username ORDER BY username"
> )
>
> and would like to convert it to web2py's DAL.
> I made this
>
> query = db().select(
> db.auth_user.id,
> db.auth_user.username,
> db.auth_user.canceled_on,
> db.auth_user.canceled_by,
> left=(
> db.auth_membership.on(db.auth_user.id == db.auth_membership.
> user_id),
> db.auth_group.on(db.auth_group.id == db.auth_membership.group_id),
> ),
> groupby=db.auth_user.username,
> orderby=db.auth_user.username,
> )
>
> but I can't find any way to integrate the sums.
>
> Does anyone know how to do it?
>
> Thanks,
>
> JM
>

-- 
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: Inject html markup with python code at run time

2019-03-24 Thread Scott Hunter
By putting your code in a string passed as an argument to XML, you are 
saying you want that string to be displayed as opposed to executed; the 
fact that it happens to be code is irrelevant.

If you want the code to run on the server, creating the page to be 
displayed, you can just put it in your view.

If you want the code to be executed in the browser, you are out of luck.

- Scott

On Sunday, March 24, 2019 at 2:29:41 PM UTC-4, yng wrote:
>
> Hi Guru's.
>
> I'm new to web2py and web development in general.
> Hope somebody can help me.
>
> I want to inject a html markup with python code at run time.
>
> controller:
> def test():
>dynamicHtml = XML('{{for x in range(2):}}{{=x}}hello{{pass}}')
>  return locals()
>
>
> view: test.html
> {{=dynamicHtml}}
>
>
> The output is this:
> {{for x in range(10):}}{{=x}}hello{{pass}}
>
> This is what I'm expecting:
> 1hello
> 2hello
>
> Hope my explanation is clear.
> What would be the best solution to implement this?
>
> Thanks advance,
> yng
>
>
>
>
>
>
>

-- 
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] Bad MySQL migration when there shouldn't be one?

2019-02-26 Thread Scott Hunter
I'm seeing the following error in a web2py 2.14.6 app @ pythonanywhere

OperationalError: (1553, "Cannot drop index 'f_User__idx': needed in a 
foreign key constraint")

This is an app that is using MySQL.  I have not changed any models, and all 
migrations are disabled, either of which not being true is what I might 
think could trigger this kind of error.  I do notice that everything in the 
compiled folder seems to have the same very recent timestamp, as if they 
were all touched recently.

I realize this is thin on details, but any ideas as to how I can a) track 
down the problem and more importantly b) solve it?

Here's the full traceback:

Traceback (most recent call last):
  File "/home/ukitms/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/ukitms/web2py/applications/init/compiled/models.db.py", line 
164, in 
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 834, in 
define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 873, in 
lazy_define_table
polymodel=polymodel)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 510, in create_table
fake_migrate=fake_migrate
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 623, in migrate_table
self.execute(sub_query)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1388, in execute
return self.log_execute(*a, **b)
  File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 1382, in log_execute
ret = self.get_cursor().execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
205, in execute
self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", 
line 36, in defaulterrorhandler
raise errorclass, errorvalue


- Scott




-- 
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: Problem w/ v2.16.1 & python3 & rest api

2018-01-05 Thread Scott Hunter
I had to use a fresh copy of web2py in order to try it with python2 
(otherwise I get an error complaining about unsupported pickle protocol), 
but that worked, including supporting basic authentication & an actual 
RESTful API.

So I'd definitely concur about this being a gap in Python3 coverage.

- Scott

On Friday, January 5, 2018 at 2:46:22 AM UTC-5, Dave S wrote:
>
>
>
> On Thursday, January 4, 2018 at 1:07:24 PM UTC-8, Scott Hunter wrote:
>>
>> If I try to user curl to call the api_get_user_email function in the 
>> default controller of the welcome app, using a fresh copy of web2py & under 
>> python 3.6.3, the following ticket gets generated:
>>
>>  a bytes-like object is required, not 'str'Version
>> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>>
>> Traceback (most recent call last):
>>   File "/Users/shunter/Dropbox/web2py-v2.16.1/gluon/restricted.py", line 
>> 219, in restricted
>> exec(ccode, environment)
>> TypeError: a bytes-like object is required, not 'str'
>> [...]
>>
>>  
>
>> Any guidance as to what needs to be fixed would be appreciated.
>>
>>
>> - Scott
>>
>
> I'd say it was a place where the port to Python 3 was incomplete.  Have 
> you tried using the  API url in Python 3 before?  If you set up the same 
> test using a Python 2 environment, does it work?
>
> /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.


[web2py] Problem w/ v2.16.1 & python3 & rest api

2018-01-04 Thread Scott Hunter
If I try to user curl to call the api_get_user_email function in the 
default controller of the welcome app, using a fresh copy of web2py & under 
python 3.6.3, the following ticket gets generated:

 a bytes-like object is required, not 'str'Version
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.

Traceback (most recent call last):
  File "/Users/shunter/Dropbox/web2py-v2.16.1/gluon/restricted.py", line 219, 
in restricted
exec(ccode, environment)
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shunter/Dropbox/web2py-v2.16.1/gluon/restricted.py", line 141, 
in __init__
self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'

In file: 
/Users/shunter/Dropbox/web2py-v2.16.1/applications/welcome/controllers/default.py

1.

 at 0x109a970c0, file 
"/Users/shunter/Dropbox/web2py-v2.16.1/applications/welcome/controllers/default.py",
 line 8>



As I haven't introduced any code to this setup, either there is a bug or I 
am calling this incorrectly; here's the curl command:

curl --user username:password 
http://127.0.0.1:8000/welcome/default/api_get_user_email


Any guidance as to what needs to be fixed would be appreciated.


- Scott

-- 
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] Remote database synchronization

2017-12-08 Thread Scott Hunter
The technique put forth in Chapter 6 of the book says every record must 
"reference 
the UUID instead of the id", and the example redefines a field of 
db.dog from `Field('owner', db.person),` to Field('owner', length=64),``, 
adding `db.dog.owner.requires = IS_IN_DB(db,'person.uuid','%(name)s')`. 

Does this mean that things like SQLFORM.grid will not work for tables 
defined so?  What about tables like those part of `auth`?

If these parts of web2py will no longer work, is there a recommended way to 
synchronize remote databases that does not have these issues?

- Scott

-- 
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] Scheduler on PythonAnywhere not working since Dec 1

2017-12-06 Thread Scott Hunter
Since Dec 1, I can no longer schedule tasks in the scheduler for my web2py 
(Version 2.14.6-stable+timestamp.2016.05.10.00.21.47) app on 
PythonAnywhere.com; the task log is a LONG permutation of the following 3 
lines:

ERROR:web2py.scheduler.giles-livetask1#7087:error popping tasks
ERROR:web2py.scheduler.giles-livetask1#7087:Error retrieving status
ERROR:web2py.scheduler.giles-livetask1#7087:Error coordinating TICKER

interspersed every hour with something like

Failed to acquire lock, task must already be running
2017-12-06 08:04:12 -- Completed task, took 6.00 seconds, return code 
was 0.

I have tried restarting the scheduler, to no (helpful) effect.  So my 
question is: how do I get this scheduler working again?

-- 
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] Possible bug using | at end of element of list:string

2017-11-29 Thread Scott Hunter
Suppose I have a list:string field, and I put `A|B` in for one of the 
elements.  This works as expected, and gets represented internally as 
`|A||B|`.

Now suppose I break that up into 2 elements: `A|` followed by `B`.  When I 
submit the form (a smart grid, in my case), it comes back with a single 
element: `A||B`, with the internal representation `|A|||B|`.

The same thing happens if the 2 elements as `A` followed by `|B`: single 
element `A||B`, internally `|A||B|`.

This looks like a bug to me, but thought I'd check here first.  I'm using 
v2.16.1 
under python2.7 on MacOS 10.12.6

- Scott

-- 
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: web2py 2.15.3-stable: trying to re-bind a field?

2017-08-08 Thread Scott Hunter
How would I determine that, and what would I do about it?  I upgraded using 
the "wizard".

- Scott

On Tuesday, August 8, 2017 at 11:09:42 PM UTC-4, Anthony wrote:
>
> Is it possible when you upgraded to 2.15.3, you failed to get the updated 
> pydal that goes with it?
>
> On Tuesday, August 8, 2017 at 10:20:58 PM UTC-4, Scott Hunter wrote:
>>
>> I have code in my db.py model to add fields to auth_user:
>>
>> auth_extras = [
>> Field('paid', 'boolean',writable=False,readable=False),
>> Field('paidwhen', 'date',writable=False,readable=False),
>> Field('paidamount', 'float',writable=False,readable=False),
>> Field('paymentid',writable=False,readable=False),
>> Field('paidYears','list:integer',default=list(), 
>> writable=False,readable=False )
>> ]
>> auth.settings.extra_fields['auth_user'] = auth_extras
>> auth.define_tables(username=False, signature=False)
>>
>> Which worked fine, until I upgraded to 2.15.3; now I get:
>>
>> 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.
>>
>> Traceback (most recent call last):
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
>> <http://127.0.0.1:8001/admin/default/edit/init/models/menu.py>, line 178, in 
>> 
>> if DEVELOPMENT_MENU: _()
>>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
>> <http://127.0.0.1:8001/admin/default/edit/init/models/menu.py>, line 49, in _
>> if auth.has_membership('admin'):
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in 
>> has_membership
>> membership = self.table_membership()
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in 
>> table_membership
>> return self.db[self.settings.table_membership_name]
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 663, in __getitem__
>> return self.__getattr__(str(key))
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 669, in __getattr__
>> return self.lazy_define_table(tablename, *fields, **args)
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 603, in lazy_define_table
>> table._create_references()
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 456, in _create_references
>> rtable = db[rtablename]
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 663, in __getitem__
>> return self.__getattr__(str(key))
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 669, in __getattr__
>> return self.lazy_define_table(tablename, *fields, **args)
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 599, in lazy_define_table
>> table = table_class(self, tablename, *fields, **args)
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 351, in __init__
>> field.bind(self)
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 1633, in bind
>> 'Field %s is already bound to a table' % self.longname)
>> ValueError: Field auth_user.paid is already bound to a table
>>
>>
>> Which is true, but web2py used to know that.  Doesn't matter if 
>> migrations are enabled or not; I get the same part of the trace from the 
>> call to self.lazy_define_table if I comment out the call to 
>> auth.has_membership.
>>
>>

-- 
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] web2py 2.15.3-stable: trying to re-bind a field?

2017-08-08 Thread Scott Hunter
I have code in my db.py model to add fields to auth_user:

auth_extras = [
Field('paid', 'boolean',writable=False,readable=False),
Field('paidwhen', 'date',writable=False,readable=False),
Field('paidamount', 'float',writable=False,readable=False),
Field('paymentid',writable=False,readable=False),
Field('paidYears','list:integer',default=list(), 
writable=False,readable=False )
]
auth.settings.extra_fields['auth_user'] = auth_extras
auth.define_tables(username=False, signature=False)

Which worked fine, until I upgraded to 2.15.3; now I get:

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.

Traceback (most recent call last):
  File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
, line 178, in 

if DEVELOPMENT_MENU: _()
  File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
, line 49, in _
if auth.has_membership('admin'):
  File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in 
has_membership
membership = self.table_membership()
  File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in 
table_membership
return self.db[self.settings.table_membership_name]
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 663, in __getitem__
return self.__getattr__(str(key))
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 603, in lazy_define_table
table._create_references()
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 456, in _create_references
rtable = db[rtablename]
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 663, in __getitem__
return self.__getattr__(str(key))
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 599, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 351, in __init__
field.bind(self)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 1633, in bind
'Field %s is already bound to a table' % self.longname)
ValueError: Field auth_user.paid is already bound to a table


Which is true, but web2py used to know that.  Doesn't matter if migrations 
are enabled or not; I get the same part of the trace from the call to self.
lazy_define_table if I comment out the call to auth.has_membership.

-- 
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: web2py using "foreign" form

2017-03-23 Thread Scott Hunter
There is no `request.post_vars`, and thus no 
`request.post_vars.stripeToken`, when the controller the form was submitted 
to executes.

I cannot see any such hidden field in the DOM, but there not being one 
would explain why it isn't getting back to me.

Further poking around, I found a section (not displayed) of class 
stripeErrorMessage, the contents of which says 

Sorry, there was a problem loading Checkout.

If this persists, please try a different browser.
  
But I'm thinking that is there to be displayed IF there is a problem, as 
the form comes up fine and responds to the credit card number appropriately 
(except for giving me back the token).

On Thursday, March 23, 2017 at 6:08:59 PM UTC-4, Anthony wrote:
>
> On Thursday, March 23, 2017 at 10:20:29 AM UTC-4, Scott Hunter wrote:
>>
>> That's what I would have thought, but if I have the following in my view:
>>
>> > "POST">
>>   > src="<a  rel="nofollow" href="https://checkout.stripe.com/checkout.js&quot">https://checkout.stripe.com/checkout.js&quot</a>; class="stripe-button"
>> data-email="{{=auth.user.email}}"
>> data-key="{{=pk}}"
>> data-amount="{{=amount}}"
>> data-name="UKI TMS"
>> data-description="{{=description}}"
>> data-image="
>> <a  rel="nofollow" href="https://stripe.com/img/documentation/checkout/marketplace.png&quot">https://stripe.com/img/documentation/checkout/marketplace.png&quot</a>;
>> data-panel-label="{{=label}}"
>> data-locale="auto">
>>   
>> 
>>
>> and the following in my `pay` controller:
>>
>> def charge():
>> return DIV("%r"%request,_class="well")
>>
>>
>>
>> the displayed value of `request._post_vars` is None.  Same thing if I 
>> don't specify `args` in the action URL, or leave the action URL empty (and 
>> display `request.env` from the appropriate controller).
>>
>
> That's not the way to check for posted variables. request._post_vars is 
> populated lazily the first time request.post_vars (or request.vars) is 
> accessed. You should simply check directly for 
> request.post_vars.stripeToken (which is the only field that will be posted 
> to the controller).
>  
>
>> Poking around the DOM, I see that there is *another* form inside of mine, 
>> and this is the form which contains the "submit" button (along with all of 
>> the input fields).
>>
>
> Notice in your code you are loading a Stripe Javascript script. Once 
> loaded, that script generates the form you are seeing in the DOM. That form 
> is what the user fills out, and it is submitted directly to Stripe, not to 
> your web2py server. Stripe then returns the "stripeToken" to the browser, 
> adds it to a hidden field within your form, and submits that form to the 
> web2py controller.
>
> 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: web2py using "foreign" form

2017-03-23 Thread Scott Hunter
That's what I would have thought, but if I have the following in my view:


  https://checkout.stripe.com/checkout.js&quot</a>; class="stripe-button"
data-email="{{=auth.user.email}}"
data-key="{{=pk}}"
data-amount="{{=amount}}"
data-name="UKI TMS"
data-description="{{=description}}"
data-image=
"<a  rel="nofollow" href="https://stripe.com/img/documentation/checkout/marketplace.png&quot">https://stripe.com/img/documentation/checkout/marketplace.png&quot</a>;
data-panel-label="{{=label}}"
data-locale="auto">
  


and the following in my `pay` controller:

def charge():
return DIV("%r"%request,_class="well")



the displayed value of `request._post_vars` is None.  Same thing if I don't 
specify `args` in the action URL, or leave the action URL empty (and 
display `request.env` from the appropriate controller).

Poking around the DOM, I see that there is *another* form inside of mine, 
and this is the form which contains the "submit" button (along with all of 
the input fields).

Even more confused now,
Scott

On Thursday, March 23, 2017 at 9:28:50 AM UTC-4, Anthony wrote:
>
> If the form is submitted via a POST request, everything will be in 
> request.post_vars (request.post_vars is not specific to web2py-generated 
> forms -- it is simply where posted data are made available).
>
> Anthony
>
> On Thursday, March 23, 2017 at 4:52:56 AM UTC-4, Scott Hunter wrote:
>>
>> Suppose I have a form whose contents are generated by a script, and I do 
>> not know what those contents are; in particular, I may not know what the 
>> fields are within that form, but I certainly have no control over them.  I 
>> can specify the controller that I want that form to submit to (via the 
>> `action` attribute).  Is there a way, within that controller, I can get the 
>> content of that submission (what would show up in `request.post_vars` for a 
>> web2py-generated form)?  Does it help if I know the names of these fields?
>>
>> - Scott
>>
>

-- 
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: Using Stripe's Checkout w/ web2py

2017-03-23 Thread Scott Hunter
I'd be very interested to see how you manage the Checkout form within the 
web2py framework.

- Scott

On Thursday, March 23, 2017 at 4:11:02 AM UTC-4, Mathieu Clabaut wrote:
>
> I have a working stripe integration in web2py which is closely based to 
> what the gluon/contrib/stripe.py provides.
> I'll try to provide more information this evening.
>
> On Thu, Mar 23, 2017 at 2:47 AM Dave S <snide...@gmail.com > 
> wrote:
>
>>
>>
>> On Wednesday, March 22, 2017 at 6:42:42 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, March 22, 2017 at 6:29:38 PM UTC-7, Scott Hunter wrote:
>>>>
>>>> From the deafening silence, apparently this was not enough detail for 
>>>> anyone to even ask what other details I need to provide, so I'll do it 
>>>> myself: what other info do I need to provide to get some kind of response?
>>>>
>>>> - Scott
>>>>
>>>
>>> I suspect that Stripe users here are in the minority of the minority.  
>>> There are people here handling payments through similar sites, judging by 
>>> the occasional post here, and there's the info in the book.  Saying that 
>>> pretty near exhausts what I know about the subject, although I've been at 
>>> presentations about the role of OAUTH2 in some of the implementations.
>>>
>>> /dps
>>>
>>>
>> I think Massimo has done all the US-accessible methods, at least for 
>> testing, and it occurs to me that some of his videos may touch upon that, 
>> but I haven't watched enough of them to tell you which one, or whether it 
>> uses Stripe, but here's a post about his use of it:
>>
>> https://groups.google.com/d/msg/web2py/Ou_Qc0-mucs/etrCBfoOM5MJ
>> >
>>
>> /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+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] web2py using "foreign" form

2017-03-23 Thread Scott Hunter
Suppose I have a form whose contents are generated by a script, and I do 
not know what those contents are; in particular, I may not know what the 
fields are within that form, but I certainly have no control over them.  I 
can specify the controller that I want that form to submit to (via the 
`action` attribute).  Is there a way, within that controller, I can get the 
content of that submission (what would show up in `request.post_vars` for a 
web2py-generated form)?  Does it help if I know the names of these fields?

- Scott

-- 
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: Using Stripe's Checkout w/ web2py

2017-03-22 Thread Scott Hunter
>From the deafening silence, apparently this was not enough detail for 
anyone to even ask what other details I need to provide, so I'll do it 
myself: what other info do I need to provide to get some kind of response?

- Scott

On Wednesday, March 22, 2017 at 4:22:24 AM UTC-4, Scott Hunter wrote:
>
> I enter the credit cad info, the submit button turns green w/ the animated 
> check box after being pressed, and the appropriate controller gets invoked. 
>  But there is nothing in the request about the token: no post vars (which 
> makes sense, since it isn't using a web2py-generated form), but not even in 
> any of the more "raw" parts, or at least not so that I can recognize it.
>
> So either I need to modify the form (which seems problematic, since Stripe 
> does all of it within a script, like so):
>
> 
>src="<a  rel="nofollow" href="https://checkout.stripe.com/checkout.js&quot">https://checkout.stripe.com/checkout.js&quot</a>; class="stripe-button"
> data-email="...@gmail.com"
> data-key="pk_test_..."
> data-amount="3"
> data-name="UKI TMS"
> data-description="Trials in 2017 ($300)"
> data-image="
> <a  rel="nofollow" href="https://stripe.com/img/documentation/checkout/marketplace.png&quot">https://stripe.com/img/documentation/checkout/marketplace.png&quot</a>;
> data-panel-label="Pay {{amount}} for 2017"
> data-locale="auto">
>   
> 
>
>
> or the controller, but since I can't tell where the information I need is, 
> I can't tell how to get it.
>
> I've been using web2py's Stripe module, but been getting errors about not 
> using TSL1.2; so instead of trying to mess with that, thought I would go 
> directly to using one of Stripe's supported methods.
>
> - Scott
>
> On Wednesday, March 22, 2017 at 12:29:36 AM UTC-4, lyn2py wrote:
>>
>> You might need to be more detailed describing your issue. 
>>
>> On Wednesday, March 22, 2017 at 11:19:21 AM UTC+8, Scott Hunter wrote:
>>>
>>> Has anyone been able to use Stripe's Checkout with web2py?  If so, how 
>>> did you do it?  I'm having trouble getting the token it generates back.
>>>
>>> - Scott
>>>
>>

-- 
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: Using Stripe's Checkout w/ web2py

2017-03-22 Thread Scott Hunter
I enter the credit cad info, the submit button turns green w/ the animated 
check box after being pressed, and the appropriate controller gets invoked. 
 But there is nothing in the request about the token: no post vars (which 
makes sense, since it isn't using a web2py-generated form), but not even in 
any of the more "raw" parts, or at least not so that I can recognize it.

So either I need to modify the form (which seems problematic, since Stripe 
does all of it within a script, like so):


  https://checkout.stripe.com/checkout.js&quot</a>; class="stripe-button"
data-email="...@gmail.com"
data-key="pk_test_..."
data-amount="3"
data-name="UKI TMS"
data-description="Trials in 2017 ($300)"
data-image=
"<a  rel="nofollow" href="https://stripe.com/img/documentation/checkout/marketplace.png&quot">https://stripe.com/img/documentation/checkout/marketplace.png&quot</a>;
data-panel-label="Pay {{amount}} for 2017"
data-locale="auto">
  



or the controller, but since I can't tell where the information I need is, 
I can't tell how to get it.

I've been using web2py's Stripe module, but been getting errors about not 
using TSL1.2; so instead of trying to mess with that, thought I would go 
directly to using one of Stripe's supported methods.

- Scott

On Wednesday, March 22, 2017 at 12:29:36 AM UTC-4, lyn2py wrote:
>
> You might need to be more detailed describing your issue. 
>
> On Wednesday, March 22, 2017 at 11:19:21 AM UTC+8, Scott Hunter wrote:
>>
>> Has anyone been able to use Stripe's Checkout with web2py?  If so, how 
>> did you do it?  I'm having trouble getting the token it generates back.
>>
>> - Scott
>>
>

-- 
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] Using Stripe's Checkout w/ web2py

2017-03-21 Thread Scott Hunter
Has anyone been able to use Stripe's Checkout with web2py?  If so, how did 
you do it?  I'm having trouble getting the token it generates back.

- Scott

-- 
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: MySQL CSV load fails on pythonanywhere

2017-03-08 Thread Scott Hunter
Could the issue be that the IDs for the trial records in the target DB are 
different than those in the source DB (I know some are, because in the 
target they are sequential but in the source they are not)?  

If this is the issue, what would be the preferred way to consolidate the 
IDs in the source DB (which would presumably address the problem)?

- Scott

Note: I am not using the cpdb.py script to do this because it was never 
able to find DAL, even when I gave it a full path to the gluon directory

On Wednesday, March 8, 2017 at 4:52:58 AM UTC-5, Scott Hunter wrote:
>
> When I try to load a MySQL DB on pythonanywhere from a CSV generated from 
> a SQLite DB using (literally) the same schema, I get the following:
>
> >>> db.import_from_csv_file(open("trials_export.csv","rb"))   
> 
>  Traceback (most recent call last):  File 
> "", line 1, in   File 
> "/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 1116, in 
> import_from_csv_file*args, **kwargs)  File 
> "/home/ukitms/web2py/gluon/packages/dal/pydal/objects.py", line 978, in 
> import_from_csv_filenew_id = self.insert(**dict(items))  File 
> "/home/ukitms/web2py/gluon/packages/dal/pydal/objects.py", line 726, in 
> insertret = self._db._adapter.insert(self, self._listify(fields))  
> File "/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 746, in insertraise eIntegrityError: (1452, 'Cannot add or 
> update a child row: a foreign key constraint fails 
> (`ukitms$trials`.`t_classlevel`, CONSTRAINT `t_classlevel_ibfk_1` FOREIGN 
> KEY (`f_Trial`) REFERENCES `t_trial` (`id`) ON DELETE CASCADE)')>>> 
>
> The relevant part of the schema is:
>
> db.define_table( 't_classlevel', 
> Field( 'f_Trial', 'reference t_trial' ),
>
>
>
> Table `t_trial` does appear in the CSV before `t_classlevel`; I checked 
> that the `f_Trial` field in every record has a corresponding `t_trial` 
> record.
>
> Is there some way to identify what line of the CSV is causing this?  How 
> could this constraint be violated if the values all correspond to valid 
> records?
>
> - Scott
>

-- 
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] MySQL CSV load fails on pythonanywhere

2017-03-08 Thread Scott Hunter
When I try to load a MySQL DB on pythonanywhere from a CSV generated from a 
SQLite DB using (literally) the same schema, I get the following:

>>> db.import_from_csv_file(open("trials_export.csv","rb")) 

   Traceback (most recent call last):  File "", 
line 1, in   File 
"/home/ukitms/web2py/gluon/packages/dal/pydal/base.py", line 1116, in 
import_from_csv_file*args, **kwargs)  File 
"/home/ukitms/web2py/gluon/packages/dal/pydal/objects.py", line 978, in 
import_from_csv_filenew_id = self.insert(**dict(items))  File 
"/home/ukitms/web2py/gluon/packages/dal/pydal/objects.py", line 726, in 
insertret = self._db._adapter.insert(self, self._listify(fields))  File 
"/home/ukitms/web2py/gluon/packages/dal/pydal/adapters/base.py", line 746, 
in insertraise eIntegrityError: (1452, 'Cannot add or update a child 
row: a foreign key constraint fails (`ukitms$trials`.`t_classlevel`, 
CONSTRAINT `t_classlevel_ibfk_1` FOREIGN KEY (`f_Trial`) REFERENCES 
`t_trial` (`id`) ON DELETE CASCADE)')>>> 

The relevant part of the schema is:

db.define_table( 't_classlevel', 
Field( 'f_Trial', 'reference t_trial' ),



Table `t_trial` does appear in the CSV before `t_classlevel`; I checked 
that the `f_Trial` field in every record has a corresponding `t_trial` 
record.

Is there some way to identify what line of the CSV is causing this?  How 
could this constraint be violated if the values all correspond to valid 
records?

- Scott

-- 
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: Email using p7s file

2017-02-27 Thread Scott Hunter
The link reports "Account suspended", so that wasn't too useful; 
but I will check out sparkpost.com

On Monday, February 27, 2017 at 3:38:27 PM UTC-5, Dave S wrote:
>
>
>
> On Friday, February 17, 2017 at 4:57:03 AM UTC-8, Scott Hunter wrote:
>>
>> Is it possible to send email with web2py's Auth mailer using a .p7s file 
>> to sign/encrypt it?  If so, how?  
>>
>> If not, I saw (very brief) documentation on how to use x509 encryption 
>> (top of Chapter 8), but wasn't clear on what the arguments that it needed 
>> were.
>>
>> - Scott
>>
>
> I don't know if this will help, but Massimo and some other users recommend 
> SparkPost
>
> Mirek Zvolský wrote: 
> 4/15/16
>
> Why sendgrid?
> I have just implemented sparkpost (rcommended from mandrill, which 
> terminates their free services).
> 10 mails/month for free, and we have sparkpost package in pypi.
>
> Here my notes (use google translate):
> http://wikilinuxdevel.alwaysdata.net/plugin_wiki/page/sparkpost
>
>  
> Perhaps the instructions for that service cover certifying.
>
> /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.


[web2py] Re: Email using p7s file

2017-02-26 Thread Scott Hunter
Hello?

On Friday, February 17, 2017 at 7:57:03 AM UTC-5, Scott Hunter wrote:
>
> Is it possible to send email with web2py's Auth mailer using a .p7s file 
> to sign/encrypt it?  If so, how?  
>
> If not, I saw (very brief) documentation on how to use x509 encryption 
> (top of Chapter 8), but wasn't clear on what the arguments that it needed 
> were.
>
> - Scott
>

-- 
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] Email using p7s file

2017-02-17 Thread Scott Hunter
Is it possible to send email with web2py's Auth mailer using a .p7s file to 
sign/encrypt it?  If so, how?  

If not, I saw (very brief) documentation on how to use x509 encryption (top 
of Chapter 8), but wasn't clear on what the arguments that it needed were.

- Scott

-- 
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: Problem with limitby?

2016-12-14 Thread Scott Hunter
It would be the case if one were cloned from the other.

- Scott

On Wednesday, December 14, 2016 at 3:54:44 PM UTC-5, Richard wrote:
>
> You should check if both data set are the same which shouldn't be the case 
> for the machine you experiment the issue with...
>
> On Wed, Dec 14, 2016 at 3:27 PM, Scott Hunter <shu...@nycap.rr.com 
> > wrote:
>
>> I have just tried it on a different OS X machine (but same version of the 
>> OS), and did not see the problem.  And I didn't see it on pythonanywhere, 
>> so I guess it is just that one machine.
>>
>> - Scott
>>
>>
>> On Wednesday, December 14, 2016 at 2:03:10 PM UTC-5, Anthony wrote:
>>>
>>> Sorry, I cannot reproduce running on Ubuntu -- both printouts as well as 
>>> the first page of the grid (after sorting on Myfield2) all have the same 20 
>>> records when I run it. Maybe someone else can try it on OSX. What happens 
>>> if you run the OSX binary version of web2py?
>>>
>>> Anthony
>>>
>>> On Tuesday, December 13, 2016 at 6:43:57 PM UTC-5, Scott Hunter wrote:
>>>>
>>>> If I make a fresh, new app from the Administrative Interface, and 
>>>> replace the contents of default.py with the following, it will print the 
>>>> first 20 records that should show up in the grid, first without using 
>>>> limityby (and using a counter to stop at 20), and then with limityby; the 
>>>> second is missing records from the first, and matches what appears on the 
>>>> first sorted page of the grid.
>>>>
>>>> {The main contents of views/default/index.html need to be replaced with 
>>>> {{=form}} as well, to see the grid)
>>>>
>>>> import random
>>>> def index():
>>>> db.define_table('mytable', Field('myfield1', 'string'), 
>>>> Field('myfield2', 'string'))
>>>>
>>>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>>>> db.mytable.id)]
>>>> if len(f2is1_ids)==0:
>>>> db.mytable.truncate()
>>>> for v1 in random.sample(xrange(1),200):
>>>> for v2 in random.sample("ABCDE",3):
>>>> db.mytable.insert( myfield2="Value%05d"%v1, myfield1=v2 
>>>> )
>>>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>>>> db.mytable.id)]
>>>> query = db.mytable.id.belongs(f2is1_ids)
>>>> i = 0
>>>> for d in db(query).select(orderby=db.mytable.myfield2):
>>>> print "%5d"%d.id, d.myfield1, d.myfield2
>>>> i += 1
>>>> if i==20:
>>>> break
>>>> print"---"
>>>> for d in 
>>>> db(query).select(orderby=db.mytable.myfield2,limitby=(0,20)):
>>>> print "%5d"%d.id, d.myfield1, d.myfield2
>>>> args = { 'orderby':db.mytable.myfield1, 'editable':False, 
>>>> 'deletable':False}
>>>> form = SQLFORM.grid(query, csv=False, details=False, 
>>>> searchable=False, create=False,
>>>> paginate = 20,
>>>> orderby=db.mytable.myfield1, editable=False, 
>>>> deletable=False)
>>>> return locals()
>>>>
>>>>
>>>> On Tuesday, December 13, 2016 at 3:01:19 PM UTC-5, Anthony wrote:
>>>>>
>>>>> While including id may make a difference in general, it should (and 
>>>>>> did) not in this case: the reason for the long belongs list is that 
>>>>>> queries 
>>>>>> are made to insure that no 2 records with the same Dog_ID appear in that 
>>>>>> list.
>>>>>>
>>>>>
>>>>> Sorry, I didn't notice that the first field in your print statements 
>>>>> was f_Dog_ID (thought it was just the id field).
>>>>>
>>>>> Anyway, it's not clear what the problem is. I suggest you pack and 
>>>>> attach a minimal app that exhibits the behavior.
>>>>>
>>>>> 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+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: Problem with limitby?

2016-12-14 Thread Scott Hunter
I have just tried it on a different OS X machine (but same version of the 
OS), and did not see the problem.  And I didn't see it on pythonanywhere, 
so I guess it is just that one machine.

- Scott

On Wednesday, December 14, 2016 at 2:03:10 PM UTC-5, Anthony wrote:
>
> Sorry, I cannot reproduce running on Ubuntu -- both printouts as well as 
> the first page of the grid (after sorting on Myfield2) all have the same 20 
> records when I run it. Maybe someone else can try it on OSX. What happens 
> if you run the OSX binary version of web2py?
>
> Anthony
>
> On Tuesday, December 13, 2016 at 6:43:57 PM UTC-5, Scott Hunter wrote:
>>
>> If I make a fresh, new app from the Administrative Interface, and replace 
>> the contents of default.py with the following, it will print the first 20 
>> records that should show up in the grid, first without using limityby (and 
>> using a counter to stop at 20), and then with limityby; the second is 
>> missing records from the first, and matches what appears on the first 
>> sorted page of the grid.
>>
>> {The main contents of views/default/index.html need to be replaced with 
>> {{=form}} as well, to see the grid)
>>
>> import random
>> def index():
>> db.define_table('mytable', Field('myfield1', 'string'), 
>> Field('myfield2', 'string'))
>>
>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>> db.mytable.id)]
>> if len(f2is1_ids)==0:
>> db.mytable.truncate()
>> for v1 in random.sample(xrange(1),200):
>> for v2 in random.sample("ABCDE",3):
>> db.mytable.insert( myfield2="Value%05d"%v1, myfield1=v2 )
>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>> db.mytable.id)]
>> query = db.mytable.id.belongs(f2is1_ids)
>> i = 0
>> for d in db(query).select(orderby=db.mytable.myfield2):
>> print "%5d"%d.id, d.myfield1, d.myfield2
>> i += 1
>> if i==20:
>> break
>> print"---"
>> for d in db(query).select(orderby=db.mytable.myfield2,limitby=(0,20)):
>> print "%5d"%d.id, d.myfield1, d.myfield2
>> args = { 'orderby':db.mytable.myfield1, 'editable':False, 
>> 'deletable':False}
>> form = SQLFORM.grid(query, csv=False, details=False, 
>> searchable=False, create=False,
>> paginate = 20,
>> orderby=db.mytable.myfield1, editable=False, deletable=False)
>> return locals()
>>
>>
>> On Tuesday, December 13, 2016 at 3:01:19 PM UTC-5, Anthony wrote:
>>>
>>> While including id may make a difference in general, it should (and did) 
>>>> not in this case: the reason for the long belongs list is that queries are 
>>>> made to insure that no 2 records with the same Dog_ID appear in that list.
>>>>
>>>
>>> Sorry, I didn't notice that the first field in your print statements was 
>>> f_Dog_ID (thought it was just the id field).
>>>
>>> Anyway, it's not clear what the problem is. I suggest you pack and 
>>> attach a minimal app that exhibits the behavior.
>>>
>>> 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: Problem with limitby?

2016-12-14 Thread Scott Hunter
You read it too rapidly.

I am *not* getting the same results with and without limitby, which is the 
whole point.  In particular, the first 20 records produced by the query 
without limitby contains records that do not appear in the 20 records 
produced when limitby=(0,20) is used; the 20 records produced using limitby 
are the same as those that appear on the first page of the listing produced 
by grid (as expected).

My use of belongs *does* force a unique id because the list passed to it 
was constructed precisely to enforce that condition.

- Scott


On Wednesday, December 14, 2016 at 3:12:05 PM UTC-5, Richard wrote:
>
> Hello Scott,
>
> You mention that both results set were the same with and without limitby, 
> I guess is because the number of record your query return is already 20 or 
> even less record so, limitby don't kick in and is useless because your data 
> set has too few records... You also mention that belongs would force your 
> query to return only unique id, this is false, belongs use a list or a 
> tuple and the same id can be include multiple time, though it will be 
> unique if belongs criteria is a unique for a give column in the table such 
> as the primary key or if you put a unique constains over a foreign key 
> reference field...
>
> I read this thread rapidly, but to me your issue is coming from not using 
> orderby or as Anthony mention having an args that would influence the way 
> query is made by the grid which you can't reproduce when query your self 
> the db because you don't include the args.
>
> Good luck
>
> Richard
>
> On Wed, Dec 14, 2016 at 2:03 PM, Anthony <abas...@gmail.com > 
> wrote:
>
>> Sorry, I cannot reproduce running on Ubuntu -- both printouts as well as 
>> the first page of the grid (after sorting on Myfield2) all have the same 20 
>> records when I run it. Maybe someone else can try it on OSX. What happens 
>> if you run the OSX binary version of web2py?
>>
>> Anthony
>>
>> On Tuesday, December 13, 2016 at 6:43:57 PM UTC-5, Scott Hunter wrote:
>>>
>>> If I make a fresh, new app from the Administrative Interface, and 
>>> replace the contents of default.py with the following, it will print the 
>>> first 20 records that should show up in the grid, first without using 
>>> limityby (and using a counter to stop at 20), and then with limityby; the 
>>> second is missing records from the first, and matches what appears on the 
>>> first sorted page of the grid.
>>>
>>> {The main contents of views/default/index.html need to be replaced with 
>>> {{=form}} as well, to see the grid)
>>>
>>>
>>> import random
>>> def index():
>>> db.define_table('mytable', Field('myfield1', 'string'), 
>>> Field('myfield2', 'string'))
>>>
>>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>>> db.mytable.id)]
>>> if len(f2is1_ids)==0:
>>> db.mytable.truncate()
>>> for v1 in random.sample(xrange(1),200):
>>> for v2 in random.sample("ABCDE",3):
>>> db.mytable.insert( myfield2="Value%05d"%v1, myfield1=v2 )
>>> f2is1_ids = [x.id for x in db(db.mytable.myfield1=="A").select(
>>> db.mytable.id)]
>>> query = db.mytable.id.belongs(f2is1_ids)
>>> i = 0
>>> for d in db(query).select(orderby=db.mytable.myfield2):
>>> print "%5d"%d.id, d.myfield1, d.myfield2
>>> i += 1
>>> if i==20:
>>> break
>>> print"---"
>>> for d in 
>>> db(query).select(orderby=db.mytable.myfield2,limitby=(0,20)):
>>> print "%5d"%d.id, d.myfield1, d.myfield2
>>> args = { 'orderby':db.mytable.myfield1, 'editable':False, 
>>> 'deletable':False}
>>> form = SQLFORM.grid(query, csv=False, details=False, 
>>> searchable=False, create=False,
>>> paginate = 20,
>>> orderby=db.mytable.myfield1, editable=False, deletable=False)
>>> return locals()
>>>
>>>
>>> On Tuesday, December 13, 2016 at 3:01:19 PM UTC-5, Anthony wrote:
>>>>
>>>> While including id may make a difference in general, it should (and 
>>>>> did) not in this case: the reason for the long belongs list is that 
>>>>> queries 
>>>>> are made to insure that no 2 records with the same Dog_ID appear in that 
>>>>> list.
>>>>>
>>>>
>>>> Sorry, 

[web2py] Re: Problem with limitby?

2016-12-13 Thread Scott Hunter
If I make a fresh, new app from the Administrative Interface, and replace 
the contents of default.py with the following, it will print the first 20 
records that should show up in the grid, first without using limityby (and 
using a counter to stop at 20), and then with limityby; the second is 
missing records from the first, and matches what appears on the first 
sorted page of the grid.

import random
def index():
db.define_table('mytable', Field('myfield1', 'string'), 
Field('myfield2', 'string'))

f2is1_ids = [x.id for x in 
db(db.mytable.myfield1=="A").select(db.mytable.id)]
if len(f2is1_ids)==0:
db.mytable.truncate()
for v1 in random.sample(xrange(1),200):
for v2 in random.sample("ABCDE",3):
db.mytable.insert( myfield2="Value%05d"%v1, myfield1=v2 )
f2is1_ids = [x.id for x in 
db(db.mytable.myfield1=="A").select(db.mytable.id)]
query = db.mytable.id.belongs(f2is1_ids)
i = 0
for d in db(query).select(orderby=db.mytable.myfield2):
print "%5d"%d.id, d.myfield1, d.myfield2
i += 1
if i==20:
break
print"---"
for d in db(query).select(orderby=db.mytable.myfield2,limitby=(0,20)):
print "%5d"%d.id, d.myfield1, d.myfield2
args = { 'orderby':db.mytable.myfield1, 'editable':False, 
'deletable':False}
form = SQLFORM.grid(query, csv=False, details=False, searchable=False, 
create=False,
paginate = 20,
orderby=db.mytable.myfield1, editable=False, deletable=False)
return locals()


On Tuesday, December 13, 2016 at 3:01:19 PM UTC-5, Anthony wrote:
>
> While including id may make a difference in general, it should (and did) 
>> not in this case: the reason for the long belongs list is that queries are 
>> made to insure that no 2 records with the same Dog_ID appear in that list.
>>
>
> Sorry, I didn't notice that the first field in your print statements was 
> f_Dog_ID (thought it was just the id field).
>
> Anyway, it's not clear what the problem is. I suggest you pack and attach 
> a minimal app that exhibits the behavior.
>
> 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: Problem with limitby?

2016-12-13 Thread Scott Hunter


On Tuesday, December 13, 2016 at 11:57:48 AM UTC-5, Anthony wrote:
>
> On Tuesday, December 13, 2016 at 3:11:42 AM UTC-5, Scott Hunter wrote:
>>
>> The first 20 records appear in the same order in each case (using 
>> DBBrowser).  How does that help?
>>
>
> The first and third SQL queries (that I listed, not from your original 
> list) presumably are those from your print statements, and the second 
> should be from the grid after you have clicked the f_Dog_ID column to sort 
> on it. You claim in web2py your second print query and the grid query are 
> the same as each other but different from the first print query, but in 
> DBBrowser all three are the same. Is that correct?
>

Correct. 

>
> Note, in general, we should not expect your two print queries to yield the 
> same order as each other or the grid query. The reason is that in the print 
> queries, your "order by" clause does not specify a unique ordering of the 
> records (since many records have the same value of f_Dog_ID). Only the grid 
> query guarantees a consistent ordering of records, as it breaks any ties on 
> f_Dog_ID by also including the "id" column in the "order by" clause.
>
> In web2py, if you add the "id" field to the orderby (i.e., 
> orderby=db.t_dog.f_Dog_ID|db.t_dog.id) in your print statements, do you 
> then get the same order as the grid? If not, perhaps you can post a minimal 
> app that reproduces the problem.
>

I'm a bit confused: I get the same result when I use limitby whether or not 
I include id in the sort key, which is the same as what appears in the 
grid.  What is different (and correct) is when I do NOT use limitby.

While including id may make a difference in general, it should (and did) 
not in this case: the reason for the long belongs list is that queries are 
made to insure that no 2 records with the same Dog_ID appear in that list. 
So in this case, since, by design, every record to appear DOES have a 
unique value for the sort (orderby) key, so there are no ties to be broken, 
and there is a unique correct ordering to the records being displayed.

 
>
>>
>> I *am* using the args (in code that appears before this), and do not use 
>> any links generated by grid.
>>
>
> OK, but careful, if you ever do use any of the links in the grid, your 
> current code won't work.
>
> 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: Issues w/ Stripe?

2016-12-13 Thread Scott Hunter
The problem was with appconfig.ini; I had moved the Stripe tokens into it, 
but left them surrounded by quotes.

On Monday, December 12, 2016 at 9:04:24 PM UTC-5, Scott Hunter wrote:
>
> I have 2 appliances on a pythonanywhere web app, one a clone of the other, 
> both with a Stripe payment page.  One of them works, the other does not; 
> when the form gets submitted, the one that fails shows the following on the 
> browser console:
>
> [Error] Failed to load resource: the server responded with a status of 
> 401 (Unauthorized) (tokens, line 0)
>
> and shows the URL https://api.stripe.com/v1/tokens
>
> Stripe Support says I should "manually" use Stripe.js, but it looks like 
> gluon.contrib.stripe is already doing this.
>
> This has been working up until this past September (hasn't been tried 
> since then until today).
>
> Running web2py Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Any thoughts as to what might be the problem, or even better, how to fix 
> it?
>
> - Scott
>

-- 
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: Issues w/ Stripe?

2016-12-13 Thread Scott Hunter
It does not appear to have any notion of an appliance; they are just 
different URLs on the same domain.  I didn't use the backup appliance until 
the real one stopped working.

- Scott

On Monday, December 12, 2016 at 10:49:30 PM UTC-5, Dave S wrote:
>
>
>
> On Monday, December 12, 2016 at 6:04:24 PM UTC-8, Scott Hunter wrote:
>>
>> I have 2 appliances on a pythonanywhere web app, one a clone of the 
>> other, both with a Stripe payment page.  One of them works, the other does 
>> not; when the form gets submitted, the one that fails shows the following 
>> on the browser console:
>>
>> [Error] Failed to load resource: the server responded with a status 
>> of 401 (Unauthorized) (tokens, line 0)
>>
>> and shows the URL https://api.stripe.com/v1/tokens
>>
>> Stripe Support says I should "manually" use Stripe.js, but it looks like 
>> gluon.contrib.stripe is already doing this.
>>
>> This has been working up until this past September (hasn't been tried 
>> since then until today).
>>
>> Running web2py Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>>
>> Any thoughts as to what might be the problem, or even better, how to fix 
>> it?
>>
>>
> Does each appliance need it's own Stripe identifier/token/mumblemumble ?
>
> - Scott
>>
>
> /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.


[web2py] Re: Problem with limitby?

2016-12-13 Thread Scott Hunter
The first 20 records appear in the same order in each case (using 
DBBrowser).  How does that help?

I *am* using the args (in code that appears before this), and do not use 
any links generated by grid.

- Scott

On Monday, December 12, 2016 at 11:22:53 PM UTC-5, Anthony wrote:
>
> Run the following two queries using an external SQLite client (not web2py 
> or the DAL):
>
> SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, t_dog.
> f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE (
> t_dog.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,
> 1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706
> ,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598
> ,603,606,607,610,613,615,618,659,634,635,638)) ORDER BY t_dog.f_Dog_ID 
> LIMIT 20 OFFSET 0;
>
> SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog 
> WHERE (t_dog.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,
> 1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700
> ,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,
> 1422,598,603,606,607,610,613,615,618,659,634,635,638)) ORDER BY t_dog.
> f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;
>
> Do you get exactly the same results in each case? If so, do you get a 
> different top 20 results when you run:
>
> SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, t_dog.
> f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE (
> t_dog.id IN (1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,
> 1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706
> ,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598
> ,603,606,607,610,613,615,618,659,634,635,638)) ORDER BY t_dog.f_Dog_ID;
>
> Also, why do you have args=request.args in your call to the grid? The 
> "args" argument is for args in the URL that you want the grid to preserve 
> (i.e., args that are not related to the grid itself), but you don't appear 
> to be using any request.args elsewhere in your code. In any case, even if 
> you do have some args to preserve, you would not want to include all of 
> request.args, because when a grid link is clicked, that will include the 
> grid's args as well.
>
> Anthony
>
> On Monday, December 12, 2016 at 9:32:45 PM UTC-5, Scott Hunter wrote:
>>
>> This is the code for my grid:
>>
>> query = (db.t_classlevel.f_Trial==t.id)&(db.t_classlevel.id
>> ==db.t_run.f_Class_Level)&(db.t_run.f_Dog==db.t_dog.id)
>> fields = [db.t_dog.f_Name,db.t_dog.f_Breed,db.t_dog.f_Dog_ID]
>> dog_ids = [x.id for x in db(query).select(db.t_dog.id
>> ,distinct=True)]
>> query = db.t_dog.id.belongs(dog_ids)
>> # These two loops were added to demonstrate the problem
>> for d in db(query).select(orderby=db.t_dog.f_Dog_ID):
>> print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
>> print"---"
>> for d in 
>> db(query).select(orderby=db.t_dog.f_Dog_ID,limitby=(0,20)):
>> print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
>> headers = 
>> {'t_dog.f_Name':'Name','t_dog.f_Breed':'Breed','t_dog.f_Dog_ID':'UKI ID'}
>> args = { 'maxtextlength':{'t_dog.f_Breed':30}, 
>> 'orderby':db.t_dog.f_Name, 'editable':False, 'deletable':False}
>> links = [{'header':'Manage Entry','body':lambda 
>> r:A('Edit',_href=URL(f='entry_details',args=[t.f_UKI_ID,r.f_Dog_ID],user_signature=True))}]
>> links.append( {'header':'Scribe Sheets',
>> 'body': lambda r: SPAN( *[A(("" if i==0 else ", 
>> ")+d.f_Date.strftime("%A"),
>> 
>> _href=URL(c='course',f='scribe_sheets',extension='pdf',vars={'set':'%d_%d_%d'%(t.f_UKI_ID,i,r.f_Dog_ID)},user_signature=True),
>> _target="_blank") for i,d in 
>> enumerate(tds)] ) } )
>> form = SQLFORM.grid(query, csv=False, details=False, 
>> fields=fields, headers=headers, searchable=False, create=False, 
>> args=request.args,
>> links = links, **args)
>> return locals()
>>
>> This what gets printed:
>>
>> 99 Test Collie 2
>>
>> 1350 Tovah Border Collie 2
>>
>> 1582 Lexi Border Collie 2
>>
>> 1702 Bean Border Collie 2
>>
>> 1704 Ginger Border Collie 2
>>
>> 3865 Owen Border Collie 2
>>
>> 4099 Flirt Border Collie 2
>>
>> 5169 Super G Border Collie 2
>>
>> 5199 Emme Border Collie 2
>>
>&

[web2py] Re: Problem with limitby?

2016-12-12 Thread Scott Hunter
This is the code for my grid:

query = 
(db.t_classlevel.f_Trial==t.id)&(db.t_classlevel.id==db.t_run.f_Class_Level)&(db.t_run.f_Dog==db.t_dog.id)
fields = [db.t_dog.f_Name,db.t_dog.f_Breed,db.t_dog.f_Dog_ID]
dog_ids = [x.id for x in 
db(query).select(db.t_dog.id,distinct=True)]
query = db.t_dog.id.belongs(dog_ids)
# These two loops were added to demonstrate the problem
for d in db(query).select(orderby=db.t_dog.f_Dog_ID):
print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
print"---"
for d in db(query).select(orderby=db.t_dog.f_Dog_ID,limitby=(0,20)):
print d.f_Dog_ID, d.f_Name, d.f_Breed, d.f_User
headers = 
{'t_dog.f_Name':'Name','t_dog.f_Breed':'Breed','t_dog.f_Dog_ID':'UKI ID'}
args = { 'maxtextlength':{'t_dog.f_Breed':30}, 
'orderby':db.t_dog.f_Name, 'editable':False, 'deletable':False}
links = [{'header':'Manage Entry','body':lambda 
r:A('Edit',_href=URL(f='entry_details',args=[t.f_UKI_ID,r.f_Dog_ID],user_signature=True))}]
links.append( {'header':'Scribe Sheets',
'body': lambda r: SPAN( *[A(("" if i==0 else ", 
")+d.f_Date.strftime("%A"),

_href=URL(c='course',f='scribe_sheets',extension='pdf',vars={'set':'%d_%d_%d'%(t.f_UKI_ID,i,r.f_Dog_ID)},user_signature=True),
_target="_blank") for i,d in 
enumerate(tds)] ) } )
form = SQLFORM.grid(query, csv=False, details=False, fields=fields, 
headers=headers, searchable=False, create=False, args=request.args,
links = links, **args)
return locals()

This what gets printed:

99 Test Collie 2

1350 Tovah Border Collie 2

1582 Lexi Border Collie 2

1702 Bean Border Collie 2

1704 Ginger Border Collie 2

3865 Owen Border Collie 2

4099 Flirt Border Collie 2

5169 Super G Border Collie 2

5199 Emme Border Collie 2

5202 Beamer Border Collie 2
...

---

1702 Bean Border Collie 2

1704 Ginger Border Collie 2

3865 Owen Border Collie 2

4099 Flirt Border Collie 2

5169 Super G Border Collie 2

5203 Audie Border Collie 2

The list that appears after the --- is EXACTLY what appears in the list 
grid, once I have specified to sort on f_Dog_ID.

These are the relevant SQL statements report via the response.toolabr:

SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
(((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) AND 
(t_run.f_Dog = t_dog.id));

5.39ms

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, 
t_dog.f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID;

0.17ms

SELECT  t_dog.id, t_dog.f_Dog_ID, t_dog.f_Name, t_dog.f_Breed, 
t_dog.f_Verified, t_dog.f_Lookup, t_dog.f_User, t_dog.uuid FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID LIMIT 20 OFFSET 0;

0.14ms

SELECT count(*) FROM t_dog WHERE (t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638));

0.12ms

SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;

On Monday, December 12, 2016 at 9:00:09 PM UTC-5, Anthony wrote:
>
> On Monday, December 12, 2016 at 6:55:27 PM UTC-5, Scott Hunter wrote:
>>
>> Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
>> pythonanywhere (for the version that works properly).
>>
>> I think this is the SQL you are asking for:
>>
>> PRAGMA foreign_keys=ON;
>>
>> 0.01ms
>>
>> SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
>> auth_group WHERE (auth_group.role = 'admin');
>>
>> 0.40ms
>>
>> SELECT  auth_membership.id, auth_membership.user_id, 
>> auth_membership.group_id FROM auth_membership WHERE 
>> ((auth_membership.user_id = 1) AND (auth_membership.group_id = 1));
>>
>

[web2py] Issues w/ Stripe?

2016-12-12 Thread Scott Hunter
I have 2 appliances on a pythonanywhere web app, one a clone of the other, 
both with a Stripe payment page.  One of them works, the other does not; 
when the form gets submitted, the one that fails shows the following on the 
browser console:

[Error] Failed to load resource: the server responded with a status of 
401 (Unauthorized) (tokens, line 0)

and shows the URL https://api.stripe.com/v1/tokens

Stripe Support says I should "manually" use Stripe.js, but it looks like 
gluon.contrib.stripe is already doing this.

This has been working up until this past September (hasn't been tried since 
then until today).

Running web2py Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

Any thoughts as to what might be the problem, or even better, how to fix it?

- Scott

-- 
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: Problem with limitby?

2016-12-12 Thread Scott Hunter
Web2py: version 2.14.6, on OSX (from source, python 2.7.x) and at 
pythonanywhere (for the version that works properly).

I think this is the SQL you are asking for:

PRAGMA foreign_keys=ON;

0.01ms

SELECT  auth_group.id, auth_group.role, auth_group.description FROM auth_group 
WHERE (auth_group.role = 'admin');

0.40ms

SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
(auth_membership.group_id = 1));

0.10ms

SELECT  t_trial.id, t_trial.f_Name, t_trial.f_Club, t_trial.f_UKI_ID, 
t_trial.f_Date, t_trial.f_Days, t_trial.f_RunFee, t_trial.f_MSFee, 
t_trial.f_CourseOrder, t_trial.f_LocalKey, t_trial.f_LabelType, t_trial.f_User, 
t_trial.f_PaperClasses, t_trial.uuid, t_trial.f_ReserveUser, t_trial.f_Access, 
t_trial.f_xlsx, t_trial.f_Next_Contact, t_trial.f_Next_Raw, 
t_trial.f_Next_Measurement, t_trial.f_Paid, t_trial.f_PaidWhen, 
t_trial.f_PaidAmount, t_trial.f_PaymentID, t_trial.f_Status, 
t_trial.f_Requested, t_trial.f_PaymentRecord FROM t_trial WHERE 
(t_trial.f_UKI_ID = 1321);

0.17ms

SELECT  auth_group.id, auth_group.role, auth_group.description FROM auth_group 
WHERE (auth_group.role = 'admin');

0.04ms

SELECT  auth_membership.id, auth_membership.user_id, auth_membership.group_id 
FROM auth_membership WHERE ((auth_membership.user_id = 1) AND 
(auth_membership.group_id = 1));

0.03ms

SELECT  t_trialday.id, t_trialday.f_TrialDay, t_trialday.f_Date, 
t_trialday.f_CourseNames, t_trialday.f_CLMap, t_trialday.f_SmallToTall, 
t_trialday.f_Heights, t_trialday.f_Judge, t_trialday.f_ResultCounter, 
t_trialday.f_LastResultCourse, t_trialday.f_LastResultClassCourse, 
t_trialday.f_MCJFirst, t_trialday.uuid FROM t_trialday WHERE 
(t_trialday.f_TrialDay LIKE '1321-%' ESCAPE '\') ORDER BY t_trialday.f_Date;

0.32ms

SELECT DISTINCT t_dog.id FROM t_dog, t_classlevel, t_run WHERE 
(((t_classlevel.f_Trial = 196) AND (t_classlevel.id = t_run.f_Class_Level)) AND 
(t_run.f_Dog = t_dog.id));

5.50ms

SELECT count(*) FROM t_dog WHERE (t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638));

0.18ms

SELECT  t_dog.f_Name, t_dog.f_Breed, t_dog.f_Dog_ID, t_dog.id FROM t_dog WHERE 
(t_dog.id IN 
(1666,1667,1669,1671,1673,650,1675,652,1677,1678,1680,1688,1682,1411,1684,661,662,664,1689,1690,667,1692,1694,1696,673,1698,1700,1706,683,685,691,692,694,649,698,699,578,651,580,585,587,588,589,1686,1422,598,603,606,607,610,613,615,618,659,634,635,638))
 ORDER BY t_dog.f_Dog_ID, t_dog.id LIMIT 20 OFFSET 0;

0.15ms

PRAGMA foreign_keys=ON;


Now sure what you mean by "the SQL you are running"


On Monday, December 12, 2016 at 3:43:19 PM UTC-5, Anthony wrote:
>
> What version of web2py? Also, show us the SQL generated by web2py (check 
> db._timings, which you can view via response.toolbar()) as well as the SQL 
> you are running.
>
> Anthony
>
> On Sunday, December 11, 2016 at 11:49:53 PM UTC-5, Scott Hunter wrote:
>>
>> I'm using a SQLFORM.grid, using a query of the form:
>>
>> db.t_dog.id.belongs(dog_ids)
>>
>>
>>
>> But the listing is erratic; some records only appear when the list is 
>> sorted certain ways (except for the last page); entries on each page are in 
>> order, but entries between pages overlap.
>>
>> I thought the problem might be how grid uses limit by to get the records 
>> for a given pages, and sure enough, if I do the query myself, the query 
>> results match what appears on each page.
>>
>> For example, when sorting by code #, the start of the whole result looks 
>> like:
>>
>> 99 Test Collie 2
>>> 1350 Tovah Border Collie 2
>>> 1582 Lexi Border Collie 2
>>> 
>>> *1702 Bean Border Collie 2*
>>>
>>>
>>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
>>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>>> 5199 Emme Border Collie 2
>>> 5202 Beamer Border Collie 2
>>>* 5203 Audie Border Collie 2*
>>
>>
>> But using limitby(0,20), I get:
>>
>> 1702 Bean Border Collie 2
>>> 1704 Ginger Border Collie 2
>>> 3865 Owen Border Collie 2
>>> 4099 Flirt Border Collie 2
>>> 5169 Super G Border Collie 2
>>> 5203 Audie Border Collie 2
>>
>>
>> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>>
>

-- 
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] Problem with limitby?

2016-12-12 Thread Scott Hunter
I am using the same orderby whether using limitby or not, as I stated. 
 Thus, using orderby alone, I should get the same first 20 records in the 
same order as I would get by using limitby(0,20); I am not (again, as 
shown)  In fact, I get the same sequence using limitby(0,20) as appears on 
the first page of the SQLFORM.grid when sorted on the appropriate column.

On Monday, December 12, 2016 at 1:42:57 PM UTC-5, Richard wrote:
>
> Hello Scott,
>
> I am not sure I understand the problem... But for sure limit by alone will 
> never return you the same set of results as you didn't specify the order in 
> which you want the result to be and the analyser just favor the faster 
> quering path... So don't expect limitby alone to return the same set of 
> data each time you query the database, if it happen to be the same set it 
> just matter of chance. By using orederby you should see your problem go 
> away except if you really had found an issue that would be implementation 
> specific as you seems to point us in that direction. You can orderby over 
> table id if you have not special requirement on that matter.
>
> Richard
>
> On Sun, Dec 11, 2016 at 11:49 PM, Scott Hunter <shu...@nycap.rr.com 
> > wrote:
>
>> I'm using a SQLFORM.grid, using a query of the form:
>>
>> db.t_dog.id.belongs(dog_ids)
>>
>>
>>
>> But the listing is erratic; some records only appear when the list is 
>> sorted certain ways (except for the last page); entries on each page are in 
>> order, but entries between pages overlap.
>>
>> I thought the problem might be how grid uses limit by to get the records 
>> for a given pages, and sure enough, if I do the query myself, the query 
>> results match what appears on each page.
>>
>> For example, when sorting by code #, the start of the whole result looks 
>> like:
>>
>> 99 Test Collie 2
>>> 1350 Tovah Border Collie 2
>>> 1582 Lexi Border Collie 2
>>> 
>>> *1702 Bean Border Collie 2*
>>>
>>>
>>> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
>>> Flirt Border Collie 2**5169 Super G Border Collie 2*
>>> 5199 Emme Border Collie 2
>>> 5202 Beamer Border Collie 2
>>>* 5203 Audie Border Collie 2*
>>
>>
>> But using limitby(0,20), I get:
>>
>> 1702 Bean Border Collie 2
>>> 1704 Ginger Border Collie 2
>>> 3865 Owen Border Collie 2
>>> 4099 Flirt Border Collie 2
>>> 5169 Super G Border Collie 2
>>> 5203 Audie Border Collie 2
>>
>>
>> This is on OS X using sqlite; it seems to be fine using sqlite on Linux.
>>
>> -- 
>> 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] Problem with limitby?

2016-12-11 Thread Scott Hunter
I'm using a SQLFORM.grid, using a query of the form:

db.t_dog.id.belongs(dog_ids)



But the listing is erratic; some records only appear when the list is 
sorted certain ways (except for the last page); entries on each page are in 
order, but entries between pages overlap.

I thought the problem might be how grid uses limit by to get the records 
for a given pages, and sure enough, if I do the query myself, the query 
results match what appears on each page.

For example, when sorting by code #, the start of the whole result looks 
like:

99 Test Collie 2
> 1350 Tovah Border Collie 2
> 1582 Lexi Border Collie 2
> 
> *1702 Bean Border Collie 2*
>
>
> *1704 Ginger Border Collie 23865 Owen Border Collie 24099 
> Flirt Border Collie 2**5169 Super G Border Collie 2*
> 5199 Emme Border Collie 2
> 5202 Beamer Border Collie 2
>* 5203 Audie Border Collie 2*


But using limitby(0,20), I get:

1702 Bean Border Collie 2
> 1704 Ginger Border Collie 2
> 3865 Owen Border Collie 2
> 4099 Flirt Border Collie 2
> 5169 Super G Border Collie 2
> 5203 Audie Border Collie 2


This is on OS X using sqlite; it seems to be fine using sqlite on Linux.

-- 
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: SQLFORM.grid: using groupby disables create?

2016-12-03 Thread Scott Hunter
In my case, I have records with 2 fields, A & B; I want one record to be 
displayed for each distinct value of A when B is either 1 or 2, but it is 
possible that each will be present, so I use groupby A to avoid duplication.

I tried using a smartgrid, but it exhibited the same groupby/add behavior 
(although maybe I could use its constraint parameter to accomplish this 
without using groupby).

- Scott

On Saturday, December 3, 2016 at 11:11:58 AM UTC-5, Anthony wrote:
>
> This is tricky. Write operations (as well as the details view) are 
> disabled with groupby because the rows in the grid do not necessarily 
> represent individual records. Of course, that shouldn't necessarily 
> preclude adding new records, but from a user perspective, we have to think 
> of what is meant by "Add" in the context of a table that is displaying 
> aggregated data rather than individual records. Are you adding a new row to 
> the grid (which doesn't quite make sense) or a new individual record to the 
> table used to generate the grid (sensible, but maybe not as clear)?
>
> I don't have a strong opinion, but I suppose it wouldn't be a bad idea to 
> at least allow the developer the option of enabling create with groupby. In 
> that case, though, we might have to default to create=False for backward 
> compatibility.
>
> Feel free to file a Github issue and refer to this thread.
>
> Anthony
>
> On Saturday, December 3, 2016 at 8:53:45 AM UTC-5, Scott Hunter wrote:
>>
>> I have a SQLFORM.grid in which I would like to use groupby as well as be 
>> able to create records.  But when I supply the groupby parameter, the Add 
>> Record button disappears, and can be made to re-appear if the only thing I 
>> change is remove the groupby parameter.
>>
>> Is this a bug?  If it is a feature, can someone explain the reasoning 
>> behind it, and how I would best work around it?
>>
>> - Scott
>>
>

-- 
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] sqlform.grid search numeric fields

2016-12-03 Thread Scott Hunter
When using the basic (as opposed to advanced) search function of an 
SQLFORM.grid, it only appears to look in text fields, such that if I enter 
a number, it doesn't find any matches unless that number appears in a text 
field (even if that field is not one of the ones displayed in the grid).

Is this intentional?  Short of using the advanced search, is there a way to 
search numeric fields?

- Scott

-- 
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] SQLFORM.grid: using groupby disables create?

2016-12-03 Thread Scott Hunter
I have a SQLFORM.grid in which I would like to use groupby as well as be 
able to create records.  But when I supply the groupby parameter, the Add 
Record button disappears, and can be made to re-appear if the only thing I 
change is remove the groupby parameter.

Is this a bug?  If it is a feature, can someone explain the reasoning 
behind it, and how I would best work around it?

- Scott

-- 
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: SQLFORM.grid and oncreate error

2016-12-03 Thread Scott Hunter
My bad; I was using concrete (the callback for AFTER a record has been 
created) instead of onvalidation (the one for BEFORE that).

On Friday, December 2, 2016 at 11:17:57 PM UTC-5, Scott Hunter wrote:
>
> If the oncreate callback for a SQLFORM.grid sets form.errors to true, the 
> record is not created; similarly, if form.errors. is set to an 
> error message.
>
> However, shouldn't the form for adding the record return, and in the 
> latter case, with the specified fields showing their error messages?  In my 
> case, the list comes up instead.
>
> Here is my form & callback although there isn't much to them:
>
> def add_handler(form):
> if form.vars.f_Member_ID=='':
> form.errors.f_Member_ID = "ID required"
> session.flash = "ID required"
> return
> session.flash = "Handler added"
>
> form=SQLFORM.grid( db.t_member.f_User==t.f_User, 
> args=request.args[:2], csv=False, 
> searchable=True, deletable=False, details=False, editable=False, 
> oncreate=add_handler,
> fields=[db.t_member.f_Member_ID, db.t_member.f_FirstName, 
> db.t_member.f_LastName] )
>
> - Scott
>

-- 
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] SQLFORM.grid and oncreate error

2016-12-02 Thread Scott Hunter
If the oncreate callback for a SQLFORM.grid sets form.errors to true, the 
record is not created; similarly, if form.errors. is set to an 
error message.

However, shouldn't the form for adding the record return, and in the latter 
case, with the specified fields showing their error messages?  In my case, 
the list comes up instead.

Here is my form & callback although there isn't much to them:

def add_handler(form):
if form.vars.f_Member_ID=='':
form.errors.f_Member_ID = "ID required"
session.flash = "ID required"
return
session.flash = "Handler added"

form=SQLFORM.grid( db.t_member.f_User==t.f_User, args=request.args[:2], 
csv=False, 
searchable=True, deletable=False, details=False, editable=False, 
oncreate=add_handler,
fields=[db.t_member.f_Member_ID, db.t_member.f_FirstName, 
db.t_member.f_LastName] )

- Scott

-- 
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_osx on Sierra (OSX 10.12)

2016-10-30 Thread Scott Hunter
I downloaded a fresh copy of the source version, ran it using the default 
python in OS X, and all ran fine.

I installed Anaconda python 2.7, ran the source version using it, and all 
ran fine.

However, I was able to run the OS X version by executing the 
Content/MacOS/web2py executable inside of web2py.app via the command line.

Then I tried executing that same OS X version by double-clicking the app; 
it presented me with a different dialog: that it was from an unknown 
developer, and would not open it.  But I could open it from the Security 
panel of System Preferences, and it worked fine.

I next tried to download the same .zip file from a different server (as my 
ultimate goal is to distribute my appliance via such an executable).  That 
exhibited the problematic behavior that I have reported previously.

Lastly, I re-downloaded the zipped-app from the web2py site; opening that 
(via double-clicking) is now experiencing the behavior previously reported. 
 But I *can* open it via the command line as described above.  And after 
doing so, it will open via double-click.

So the "source" of the problem seems to have been trying to download from a 
different server.  WHY that would cause a problem, I haven't a clue.  But I 
could get around it by adding a script to open the execrable directly.

- Scott


On Saturday, October 29, 2016 at 10:42:08 PM UTC-4, Massimo Di Pierro wrote:
>
> I would recommend you download Anaconda python 2.7 and run python from 
> source
> http://web2py.com/examples/static/web2py_src.zip
>
> If it also fails, it may give more info.
>
> On Tuesday, 25 October 2016 11:55:32 UTC-5, Scott Hunter wrote:
>>
>> Sure, but there's not much to see.
>>
>> When I launch the app (after Safari, presumably, has unzipped it), I get:
>>
>>
>> <https://lh3.googleusercontent.com/-pXz7IJFnb64/WA-N_EvItiI/AW0/X7FPXoQokSoI1mxDK242IS2zvr8uHtm4QCLcB/s1600/Screen%2BShot%2B2016-10-25%2Bat%2B12.48.33%2BPM.png>
>>
>> I click Open, and (after a little wait) am presented with:
>>
>>
>> <https://lh3.googleusercontent.com/-2p-yxApP7j0/WA-OI_BvwEI/AW4/i-nDtzMEDRw36y5EBUP3RGvFedz-vQBLACLcB/s1600/Screen%2BShot%2B2016-10-25%2Bat%2B12.48.50%2BPM.png>
>>
>> If there is something relevant in the Console, it isn't obvious to me.
>>
>> - Scott
>>
>> On Tuesday, October 25, 2016 at 10:39:41 AM UTC-4, Roberto Perdomo wrote:
>>>
>>> I'm using Web2py 2.14.6 in sierra and cannot reproduce your errors.
>>>
>>> Can you show the errors or warnings?
>>>
>>> El 25 oct. 2016 10:36 AM, "Scott Hunter" <shu...@nycap.rr.com> escribió:
>>>
>>>> Am I to interpret from the deafening silence that I am the only one 
>>>> seeing this problem?  Even if that is the case, any ideas how I can 
>>>> resolve 
>>>> it, or where I might go to find any?
>>>>
>>>> - Scott
>>>>
>>>> On Wednesday, October 19, 2016 at 12:17:45 PM UTC-4, Scott Hunter wrote:
>>>>>
>>>>> When I download & run a fresh copy of the web2py_osx app, I get the 
>>>>> usual warnings about it not being from a known source (b/c it is 
>>>>> unsigned, 
>>>>> I presume).  In previous versions, when I told the Security System 
>>>>> Preference panel to open it anyway, it did, and all was well.  But now, 
>>>>> soon after it launches, I get an all-but-useless error alert "web2py 
>>>>> error" 
>>>>> with the choices of Show Console (which reveals nothing to my eye) or 
>>>>> Terminate.
>>>>>
>>>>> This is happening on 2 separate machines running Sierra.
>>>>>
>>>>> I'm at a loss as to what, if anything, I can do about it.
>>>>>
>>>>> - Scott
>>>>>
>>>> -- 
>>>> 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] Re: web2py_osx on Sierra (OSX 10.12)

2016-10-25 Thread Scott Hunter
Sure, but there's not much to see.

When I launch the app (after Safari, presumably, has unzipped it), I get:

<https://lh3.googleusercontent.com/-pXz7IJFnb64/WA-N_EvItiI/AW0/X7FPXoQokSoI1mxDK242IS2zvr8uHtm4QCLcB/s1600/Screen%2BShot%2B2016-10-25%2Bat%2B12.48.33%2BPM.png>

I click Open, and (after a little wait) am presented with:

<https://lh3.googleusercontent.com/-2p-yxApP7j0/WA-OI_BvwEI/AW4/i-nDtzMEDRw36y5EBUP3RGvFedz-vQBLACLcB/s1600/Screen%2BShot%2B2016-10-25%2Bat%2B12.48.50%2BPM.png>

If there is something relevant in the Console, it isn't obvious to me.

- Scott

On Tuesday, October 25, 2016 at 10:39:41 AM UTC-4, Roberto Perdomo wrote:
>
> I'm using Web2py 2.14.6 in sierra and cannot reproduce your errors.
>
> Can you show the errors or warnings?
>
> El 25 oct. 2016 10:36 AM, "Scott Hunter" <shu...@nycap.rr.com 
> > escribió:
>
>> Am I to interpret from the deafening silence that I am the only one 
>> seeing this problem?  Even if that is the case, any ideas how I can resolve 
>> it, or where I might go to find any?
>>
>> - Scott
>>
>> On Wednesday, October 19, 2016 at 12:17:45 PM UTC-4, Scott Hunter wrote:
>>>
>>> When I download & run a fresh copy of the web2py_osx app, I get the 
>>> usual warnings about it not being from a known source (b/c it is unsigned, 
>>> I presume).  In previous versions, when I told the Security System 
>>> Preference panel to open it anyway, it did, and all was well.  But now, 
>>> soon after it launches, I get an all-but-useless error alert "web2py error" 
>>> with the choices of Show Console (which reveals nothing to my eye) or 
>>> Terminate.
>>>
>>> This is happening on 2 separate machines running Sierra.
>>>
>>> I'm at a loss as to what, if anything, I can do about it.
>>>
>>> - Scott
>>>
>> -- 
>> 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: web2py_osx on Sierra (OSX 10.12)

2016-10-25 Thread Scott Hunter
Am I to interpret from the deafening silence that I am the only one seeing 
this problem?  Even if that is the case, any ideas how I can resolve it, or 
where I might go to find any?

- Scott

On Wednesday, October 19, 2016 at 12:17:45 PM UTC-4, Scott Hunter wrote:
>
> When I download & run a fresh copy of the web2py_osx app, I get the usual 
> warnings about it not being from a known source (b/c it is unsigned, I 
> presume).  In previous versions, when I told the Security System Preference 
> panel to open it anyway, it did, and all was well.  But now, soon after it 
> launches, I get an all-but-useless error alert "web2py error" with the 
> choices of Show Console (which reveals nothing to my eye) or Terminate.
>
> This is happening on 2 separate machines running Sierra.
>
> I'm at a loss as to what, if anything, I can do about it.
>
> - Scott
>

-- 
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: Efficiency in compiled appliance

2016-10-25 Thread Scott Hunter
Not clear what you are asking.

If compiling an app results in each function being in its own file whether 
they came from distinct source files or not, what is the benefit to having 
each function start off in its own file?

- Scott

On Wednesday, May 18, 2016 at 5:02:35 PM UTC-4, Niphlod wrote:
>
> what would be the counter-arg here ? 
>
> On Wednesday, May 18, 2016 at 9:42:50 PM UTC+2, Scott Hunter wrote:
>>
>> The web2py book, under Efficiency Tricks, says:
>>
>>
>>- Do not put many functions in the same controller but use many 
>>controllers with few functions.
>>
>> When an appliance is compiled, each of the functions is compiled into its 
>> own .pyc file, the same as would happen if they were in different functions 
>> (although the names will differ).  So does the above recommendation only 
>> apply to non-compiled appliances?
>>
>> Note that one of the earlier recommendations is:
>>
>>
>>- Bytecode compile your app using *admin*.
>>
>> -Scott
>>
>>

-- 
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] Hide flash message after some elapsed time instead of on click

2016-10-21 Thread Scott Hunter
You need single-quotes around 
flash.fadeOut("slow")

Otherwise, as you have seen, it gets executed immediately instead of after 
a delay.

On Tuesday, October 18, 2016 at 9:35:30 AM UTC-4, Marc Smith wrote:
>
> Hi, 
>
> I'm relatively new to JS but the strange quote character at the 
> beginning (I thought it was a back-tick, but doesn't appear it is) and 
> single quote at the end in that line don't look right to me -- is that 
> correct? I tried the code with Jim's change of using ".w2p_flash" but 
> it still doesn't work for me. 
>
> This is what the block of JS from web2py.js looks like currently: 
> --snip-- 
>/*helper for flash messages*/ 
>flash: function(message, status) { 
>  var flash = $('.w2p_flash'); 
>  web2py.hide_flash(); 
>  flash.html(message).addClass(status); 
>  if(flash.html()) flash.append('  
> ').slideDown(); 
>}, 
>hide_flash: function() { 
>  $('.w2p_flash').fadeOut(0).html(''); 
>}, 
> --snip-- 
>
> I tried adding this line: 
> setTimeout(flash.fadeOut("slow"),5000); 
>
> But the message fades in and out in about a second, and in Chrome's 
> developer panel, I see a "(program):1 Uncaught SyntaxError: Unexpected 
> identifier" error. 
>
> Any help would be greatly appreciated. 
>
>
> --Marc 
>
> On Wed, Jul 13, 2016 at 6:41 PM, Jim Brouzoulis 
>  wrote: 
> > Thank you very much for your help! (...and sorry for the late reply) 
> > 
> > It didn't work at first but then I noticed a typo: the class should be 
> > '.w2p_flash'. 
> > 
> > Regards 
> > // Jim 
> > 
> > 
> > Den måndag 11 juli 2016 kl. 10:49:08 UTC+2 skrev Massimiliano: 
> >> 
> >> Hi Jim, 
> >> I’m doing it in this way: 
> >> 
> >> Edit static/web2py.js search for /*helper for flash messages*/ 
> >> 
> >> and add this command: 
> >> 
> >> setTimeout(‘jQuery(".flash").fadeOut("slow")',5000); 
> >> 
> >> just after: 
> >> 
> >> if (flash.html()) flash.append('  
> >> ').slideDown(); 
> >> 
> >> Adjust 5000 that stands for 5 secods to your needs. 
> >> 
> >> 
> >> On Thu, Jul 7, 2016 at 6:00 PM, Jim Brouzoulis  
>
> >> wrote: 
> >>> 
> >>> Hi everyone, 
> >>> 
> >>> Can I easily customise the web2py.js file to automatically hide/fade 
> out 
> >>> the flash message after some given time (like a few seconds) instead 
> of 
> >>> clicking on it? If so, how? 
> >>> I have a feeling that the solution is probably not that complicated 
> but 
> >>> my js-skills aren't very impressive :) 
> >>> 
> >>> Regards 
> >>> // Jim 
> >>> 
> >>> -- 
> >>> 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. 
> >> 
> >> 
> >> 
> >> 
> >> -- 
> >> Massimiliano 
> > 
> > -- 
> > 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: insert list of dictionary

2016-10-20 Thread Scott Hunter
Your fields are of type string (the default); so either make string 
representations of your lists or declare the fields as lists of strings.

On Wednesday, October 19, 2016 at 9:15:21 AM UTC-4, Tribo Eila wrote:
>
> Hi,
>
> supposed: 
> db.define_table('color', Field('blue'),Field('yellow'),Field('red'))
>
> COLORED_THINGS = {
> 'blue': ['sky', 'jeans', 'powerline insert mode'],
> 'yellow': ['sun', 'banana', 'phone book/monitor stand'],   
>
> 'red': ['blood', 'tomato', 'test failure']}
>
> using db.color.insert(...). i'm trying to figure how to save in database 
> base on key dict. i tried for loops but my head starts turning.
>

-- 
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] web2py_osx on Sierra (OSX 10.12)

2016-10-19 Thread Scott Hunter
When I download & run a fresh copy of the web2py_osx app, I get the usual 
warnings about it not being from a known source (b/c it is unsigned, I 
presume).  In previous versions, when I told the Security System Preference 
panel to open it anyway, it did, and all was well.  But now, soon after it 
launches, I get an all-but-useless error alert "web2py error" with the 
choices of Show Console (which reveals nothing to my eye) or Terminate.

This is happening on 2 separate machines running Sierra.

I'm at a loss as to what, if anything, I can do about it.

- Scott

-- 
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: SQLFORM.grid w/ selectable generates multiple requests

2016-09-22 Thread Scott Hunter
Because I don't need it.  The original call tells me enough to make the 
modifications I need to do, and then proceeds to build an up-to-date grid, 
which becomes wasted effort because I'm getting a redirect re-build the 
page I just built.

- Scott

On Wednesday, September 21, 2016 at 3:19:15 PM UTC-4, Anthony wrote:
>
> On Wednesday, September 21, 2016 at 1:16:29 PM UTC-4, Scott Hunter wrote:
>>
>> I think I understand; seems like something that should be documented, as 
>> well as able to be disabled.
>>
>
> Is it causing a problem for you? Why do you need to disable the redirect?
>
> 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: SQLFORM.grid w/ selectable generates multiple requests

2016-09-21 Thread Scott Hunter
I think I understand; seems like something that should be documented, as 
well as able to be disabled.


On Wednesday, September 21, 2016 at 12:37:52 PM UTC-4, Anthony wrote:
>
> On Wednesday, September 21, 2016 at 9:36:14 AM UTC-4, Scott Hunter wrote:
>>
>> Here's a simple controller using an SQLFORM.grid w/ selectable:
>>
>> def open_requests():
>> print 'Req: %r' % request.vars
>> query = ...
>> form = SQLFORM.grid(query, csv=False, details=False, deletable=
>> False, editable=False, searchable=False, create=False,
>> selectable = lambda ids : None)
>> return locals()
>>
>> This, as expected, puts a checkbox on each row.  If I select two rows and 
>> hit Submit, I get the following printed from the server:
>>
>> Req: > '0720df2b-6449-43c8-a6b7-6c89dfdebcd3', '_signature': 
>> 'cbc73b5fbdc8e5961830efbe3f672f35a41d6771', '_formname': 'web2py_grid'}>
>> Req: 
>>
>> The section of the online book about this says the lambda in the 
>> selectable should be a redirect; when it was, I still got 2 requests, but 
>> the second had an added var w/ the selected IDs.
>>
>
> The book doesn't say the callback should do a redirect -- that's just an 
> example. In any case, if your callback doesn't do a redirect, then the grid 
> code itself will do a redirect back to the original URL. This is by design 
> (maybe so reloading the page or leaving and returning don't trigger a 
> browser warning and subsequent re-posting of the selected rows).
>
> 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: SQLFORM.grid w/ selectable generates multiple requests

2016-09-21 Thread Scott Hunter
If I have the controller function return a string if there is a 
'records' variable, the second request is not made; however, then it does 
not redisplay the form.

On Wednesday, September 21, 2016 at 9:36:14 AM UTC-4, Scott Hunter wrote:
>
> Here's a simple controller using an SQLFORM.grid w/ selectable:
>
> def open_requests():
> print 'Req: %r' % request.vars
> query = ...
> form = SQLFORM.grid(query, csv=False, details=False, deletable=
> False, editable=False, searchable=False, create=False,
> selectable = lambda ids : None)
> return locals()
>
> This, as expected, puts a checkbox on each row.  If I select two rows and 
> hit Submit, I get the following printed from the server:
>
> Req:  '0720df2b-6449-43c8-a6b7-6c89dfdebcd3', '_signature': 
> 'cbc73b5fbdc8e5961830efbe3f672f35a41d6771', '_formname': 'web2py_grid'}>
> Req: 
>
> The section of the online book about this says the lambda in the 
> selectable should be a redirect; when it was, I still got 2 requests, but 
> the second had an added var w/ the selected IDs.
>
> Is this the correct behavior?  If so, what is the reasoning behind it, and 
> did I miss the explanation in the book?  
>
> I'm using version 2.14.6
>

-- 
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] SQLFORM.grid w/ selectable generates multiple requests

2016-09-21 Thread Scott Hunter
Here's a simple controller using an SQLFORM.grid w/ selectable:

def open_requests():
print 'Req: %r' % request.vars
query = ...
form = SQLFORM.grid(query, csv=False, details=False, deletable=False
, editable=False, searchable=False, create=False,
selectable = lambda ids : None)
return locals()

This, as expected, puts a checkbox on each row.  If I select two rows and 
hit Submit, I get the following printed from the server:

Req: 
Req: 

The section of the online book about this says the lambda in the selectable 
should be a redirect; when it was, I still got 2 requests, but the second 
had an added var w/ the selected IDs.

Is this the correct behavior?  If so, what is the reasoning behind it, and 
did I miss the explanation in the book?  

I'm using version 2.14.6

-- 
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: app slow on pythonanywhere

2016-09-05 Thread Scott Hunter
I found the problem; migrations weren't being disabled because, while I had 
the correct settings in appconfig.ini, they were not being used properly in 
creating the db object.

- Scott

On Saturday, September 3, 2016 at 1:01:39 PM UTC-4, Scott Hunter wrote:
>
> I have an app which runs *much* slower than expected on pythonanywhere.
>
> I enabled the profiler, and one thing stood out: on pythonanywhere, the 
> function the most time was spent in, by far, is fcntl.flock from inside 
> portalocker while loading the models.  In fact, when run locally, 
> portalocker isn't even being called: it goes straight from save_dbt to 
> cPickle.dump.
>
> Is there some configuration specific to web2py that might address this, or 
> is it something I should take up w/ the people at PA?
>
> - Scott
>

-- 
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: app slow on pythonanywhere

2016-09-04 Thread Scott Hunter
I tried putting in your suggested migration settings (and reloaded); it is 
still spending about the same amount of time in fcntl.flock.

- Scott

On Sunday, September 4, 2016 at 7:27:08 AM UTC-4, 黄祥 wrote:
>
> for reload i think it's just for reload the configuration of web server 
> service (sometime it fixed some strange problem) n for the value of migrate 
> in private/appconfig.ini i think it should be true or false
> e.g.
> *models/db.py*
> db = DAL(myconf.get('db.uri'), 
> pool_size = myconf.get('db.pool_size'), 
> migrate_enabled = myconf.get('db.migrate_enabled'), 
> #migrate = myconf.get('db.migrate'), 
> #fake_migrate = myconf.get('db.fake_migrate'), 
> #fake_migrate_all = myconf.get('db.fake_migrate_all'), 
> check_reserved = ['all'], 
> lazy_tables = True)
>
> *private/appconfig.ini*
> [db]
> uri  = sqlite://a.sqlite
> pool_size= 10 ; ignored for sqlite
> migrate_enabled  = false
> migrate  = false
> fake_migrate = false
> fake_migrate_all = false
>
> 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.


[web2py] Re: app slow on pythonanywhere

2016-09-04 Thread Scott Hunter
In private/appconfig.ini on PA, [db] migrate = 0; locally, it is 1.  That 
should favor PA over local (all else being equal), yes?

On Sunday, September 4, 2016 at 1:40:09 AM UTC-4, Paolo Valleri wrote:
>
> Have you disabled migrations?
>
> Paolo
>
> On Saturday, September 3, 2016 at 7:01:39 PM UTC+2, Scott Hunter wrote:
>>
>> I have an app which runs *much* slower than expected on pythonanywhere.
>>
>> I enabled the profiler, and one thing stood out: on pythonanywhere, the 
>> function the most time was spent in, by far, is fcntl.flock from inside 
>> portalocker while loading the models.  In fact, when run locally, 
>> portalocker isn't even being called: it goes straight from save_dbt to 
>> cPickle.dump.
>>
>> Is there some configuration specific to web2py that might address this, 
>> or is it something I should take up w/ the people at PA?
>>
>> - Scott
>>
>

-- 
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: app slow on pythonanywhere

2016-09-03 Thread Scott Hunter
A number of times.  What is that supposed to have accomplished?

On Saturday, September 3, 2016 at 3:23:56 PM UTC-4, 黄祥 wrote:
>
> had you already tried to reload pythonanywhere web app?
>
> 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.


[web2py] app slow on pythonanywhere

2016-09-03 Thread Scott Hunter
I have an app which runs *much* slower than expected on pythonanywhere.

I enabled the profiler, and one thing stood out: on pythonanywhere, the 
function the most time was spent in, by far, is fcntl.flock from inside 
portalocker while loading the models.  In fact, when run locally, 
portalocker isn't even being called: it goes straight from save_dbt to 
cPickle.dump.

Is there some configuration specific to web2py that might address this, or 
is it something I should take up w/ the people at PA?

- Scott

-- 
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] Locating Table Definitions in a Module

2016-08-31 Thread Scott Hunter
Is there any benefit to putting the code to define the database tables in a 
function that has been defined in a module, but gets called from a model, 
performance-wise?

- Scott Hunter

-- 
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 invoke recurring Scheduler task

2016-08-22 Thread Scott Hunter
What is a "protected controller"?  It sounds like I need a recurring task 
to monitor my recurring task ("recurring tasks all the way down").

- Scott

On Monday, August 22, 2016 at 7:47:07 AM UTC-4, Niphlod wrote:
>
> just queue the task in a protected controller that checks before inserting 
> if another instance has been already queued and call that protected 
> controller once in a while (i.e. once per day)
>
> On Monday, August 22, 2016 at 3:10:44 AM UTC+2, Scott Hunter wrote:
>>
>> The book seems pretty clear about the call to use to start a recurring 
>> task.  
>>
>> What I am not clear on is the best way to invoke this code so that only 
>> one copy of the task is created (assuming the scheduler machinery will 
>> handle making sure that it keeps recurring).
>>
>> - Scott
>>
>

-- 
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] How to invoke recurring Scheduler task

2016-08-21 Thread Scott Hunter
The book seems pretty clear about the call to use to start a recurring 
task.  

What I am not clear on is the best way to invoke this code so that only one 
copy of the task is created (assuming the scheduler machinery will handle 
making sure that it keeps recurring).

- Scott

-- 
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: Problem with Scheduler on pythonanywhere

2016-05-31 Thread Scott Hunter
Letting the scheduler recreate the tables did the trick; thanks!

On Monday, May 30, 2016 at 8:48:11 AM UTC-4, Niphlod wrote:
>
> that error comes only on two codepaths: tables that are missing columns 
> (and/or have different column types) and database locks.
> try dropping tables, letting scheduler recreate them and see what happens.
>
> On Monday, May 30, 2016 at 1:53:04 PM UTC+2, Scott Hunter wrote:
>>
>> I have an appliance hosted on pythonanywhere which uses the Scheduler 
>> (invoked using a separate web2py process with the -K switch).
>>
>> This setup in my test environment (OS X at home) works fine, but on 
>> pythonanywhere, the scheduler process generates a stream of errors like:
>>
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error coordinating TICKER
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error coordinating TICKER
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>> ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
>> ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
>>
>>
>> Attempts to schedule a task fail to even have a new task record inserted, 
>> much less executing that task.
>>
>> It was working a week ago.  I thought it might be due to upgrading to 
>> 2.14.6, but the last successful tasks show 
>> "web2py.scheduler.giles-livetask", so maybe the problem came after that 
>> upgrade.
>>
>> I thought maybe the scheduler database was corrupted, but I can view the 
>> records via the admin appliance.
>>
>> Any suggestions as to what I should investigate next would be appreciated.
>>
>> - Scott
>>
>

-- 
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] Problem with Scheduler on pythonanywhere

2016-05-30 Thread Scott Hunter
I have an appliance hosted on pythonanywhere which uses the Scheduler 
(invoked using a separate web2py process with the -K switch).

This setup in my test environment (OS X at home) works fine, but on 
pythonanywhere, the scheduler process generates a stream of errors like:

ERROR:web2py.scheduler.giles-livetask2#30970:Error coordinating TICKER
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error coordinating TICKER
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status
ERROR:web2py.scheduler.giles-livetask2#30970:error popping tasks
ERROR:web2py.scheduler.giles-livetask2#30970:Error retrieving status


Attempts to schedule a task fail to even have a new task record inserted, 
much less executing that task.

It was working a week ago.  I thought it might be due to upgrading to 
2.14.6, but the last successful tasks show 
"web2py.scheduler.giles-livetask", so maybe the problem came after that 
upgrade.

I thought maybe the scheduler database was corrupted, but I can view the 
records via the admin appliance.

Any suggestions as to what I should investigate next would be appreciated.

- Scott

-- 
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] Scheduler menu empty (on purpose?)

2016-05-26 Thread Scott Hunter
In the latest stable release (2.14.6), the Scheduler menu is empty.  When I 
looked in widget.py, I see this:

def update_schedulers(self, start=False):
applications_folder = os.path.join(self.options.folder, 
'applications')
apps = []
##FIXME - can't start scheduler in the correct dir from Tk
if self.options.folder:
return

and self.options.folder is not empty, even though I did not pass it as a 
command line option.  If I remove this test, I get the Scheduler menu 
properly populated, but when I try to start a scheduler, it immediately 
fails.  Note that the scheduler process also fails when I try to start it 
along with the server, using -K, -X and -a.  But if I start it as a 
separate process using -K, it seems to work fine.

This is on OS X 10.11.5

- Scott

-- 
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] Efficiency in compiled appliance

2016-05-18 Thread Scott Hunter
The web2py book, under Efficiency Tricks, says:


   - Do not put many functions in the same controller but use many 
   controllers with few functions.

When an appliance is compiled, each of the functions is compiled into its 
own .pyc file, the same as would happen if they were in different functions 
(although the names will differ).  So does the above recommendation only 
apply to non-compiled appliances?

Note that one of the earlier recommendations is:


   - Bytecode compile your app using *admin*.

-Scott

-- 
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: Sending email w/ text & html

2016-04-13 Thread Scott Hunter
I tried this, but to no effect: only the HTML portion appears in the 
message, as before.

- Scott

On Tuesday, April 12, 2016 at 11:12:30 PM UTC-4, H. Das wrote:
>
> Hi can you try:
>
> mail.send(to='y...@example.com', subject=subject, message=msg, 
> headers={'Content-Type' : 'text/html'})
>
> On Tuesday, April 12, 2016 at 8:28:56 PM UTC-4, Scott Hunter wrote:
>
>> According to the current book, I should be able to do this:
>>
>> mail.send('y...@example.com',
>>   'Message subject',
>>   ('Plain text body', 'html body'))
>>
>>
>> When I try:
>>
>> msg = ("Text only","HTML Only")
>> mail.send(to='y...@example.com', subject=subject, 
>> message=msg )
>>
>>
>> the text part does not appear in the received email, only the HTML part.
>>
>> Is this a bug, or am I mis-reading the documentation?
>>
>

-- 
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 email w/ text & html

2016-04-12 Thread Scott Hunter
According to the current book, I should be able to do this:

mail.send('y...@example.com',
  'Message subject',
  ('Plain text body', 'html body'))


When I try:

msg = ("Text only","HTML Only")
mail.send(to='y...@example.com', subject=subject, message=msg )


the text part does not appear in the received email, only the HTML part.

Is this a bug, or am I mis-reading the documentation?

-- 
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: Problems validating SQLFORMs w/o DB IO

2016-01-06 Thread Scott Hunter
I've solved 1/2 of the problem: as per the documentation, `required` only 
applies to DB access; instead, I needed to supply appropriate validators 
via the `requires` parameter.

That still leaves the exception; I can understand it being an odd situation 
(validation against the DB when no DB IO is requested), and I don't get the 
exception once the appropriate `requires` parameter is supplied, but it 
doesn't seem like this should be raising an exception.

On Sunday, January 3, 2016 at 9:46:34 PM UTC-5, Scott Hunter wrote:
>
> If I create a SQLFORM from a table, but avoid DBIO (either by just calling 
> validate, or calling process(dbio=False).accepted), if a required field is 
> missing, instead of the form coming back w/ errors, It throws a NOT_IN_DB 
> exception.  
>
> def request_trial():
> form = SQLFORM(db.t_trial)
> if form.process(dbio=False).accepted:
> session.flash = "Trial Requested"
> redirect( URL(f="index", user_signature=True) )
> return locals()
>
>
>
> Here's the traceback:
>
> Traceback (most recent call last):
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/restricted.py", 
> line 227, in restricted
> exec ccode in environment
>   File 
> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
> , line 494, in 
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/globals.py", line 
> 412, in 
> self._caller = lambda f: f()
>   File 
> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
> , line 480, in request_trial
> if form.process(dbio=False).accepted:
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2304, 
> in process
> self.validate(**kwargs)
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2241, 
> in validate
> if self.accepts(**kwargs):
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/sqlhtml.py", line 
> 1505, in accepts
> **kwargs
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2122, 
> in accepts
> status = self._traverse(status, hideerror)
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 895, 
> in _traverse
> newstatus = self._validate()
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 1863, 
> in _validate
> raise Exception(msg)
> Exception: Validation error, field:f_UKI_ID 
>  object at 0x10e6bfa10>
>
>
> ... and the definition of the field in question:
>
> Field( 'f_UKI_ID', 'integer', label="UKI ID", unique=True, required=
> True ),
>
>
>
> (This may be due to the field also being required to be unique; when 
> unique is not required of any empty fields, I get the behavior described 
> below.)
>
> If instead I use a SQLFORM.factory, missing required fields pass 
> validation; here is the new definition of `form`:
>
> form = SQLFORM.factory( Field( 'Name', label="Name", required=True ) )
>
>
>
> Has this always been the behavior?  If so, can someone explain the 
> rationale behind it?
>
> This is using Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>
> - Scott Hunter
>

-- 
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] Problems validating SQLFORMs w/o DB IO

2016-01-03 Thread Scott Hunter
If I create a SQLFORM from a table, but avoid DBIO (either by just calling 
validate, or calling process(dbio=False).accept), if a required field is 
missing, instead of the form coming back w/ errors, It throws a NOT_IN_DB 
exception.

If instead I use a SQLFORM.factory, missing required fields pass validation.

Has this always been the behavior?  If so, can someone explain the 
rationale behind it?

This is using Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 

- Scott Hunter

-- 
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: Field('upload') : problem with file name

2015-07-21 Thread Scott Hunter
I'm sorry, I wasn't clear.  I was asking about the lack of documentation: 
was there a decision not to document this (if so, I'd be curious as to its 
basis), or was it just an oversight that will hopefully be remedied in the 
future?

- Scott

On Tuesday, July 21, 2015 at 10:41:55 AM UTC-4, Massimo Di Pierro wrote:

 web2py renames the uploaded filenames as tablename+code+hash.extension

 The total len(tablename+code+hash+extension)=512
 This means len(hash) = 512 - len(tablename+code+extension)
 The hash is a base64 encoded of the original filename.
 If this hash exceeds 512 - len(tablename+code+extension) the file is 
 truncated.
 Mind this is still a lot of characters.

 Massimo


 On Monday, 20 July 2015 20:36:50 UTC-5, Scott Hunter wrote:

 Is this an oversight or a conscious decision?  If I understand you, if 
 one's filesystem allowed filenames greater than 512 characters, long-enough 
 but still legal names will still be truncated, and thus thwart the ability 
 to extract the original file name.  That could be a nasty surprise.

 P.S. As I understand it, it is a permanent filename.

 On Monday, July 20, 2015 at 8:47:36 AM UTC-4, Massimo Di Pierro wrote:

 Nowhere. We only state that Field(..., lenght=) is a parameter. We 
 do not say that for upload fields this is also the length of the tmp 
 filename.

 On Monday, 20 July 2015 05:28:02 UTC-5, Scott Hunter wrote:

 Where is this spelled out in the documentation?  I could not find it.

 - Scott

 On Monday, July 20, 2015 at 2:24:24 AM UTC-4, Massimo Di Pierro wrote:

 This is handled by web2py. The filenames are truncated according to 
 the size of the uploadfield. This defaults to 512. In new versions of 
 windows the make file length has been reduced so you have to do

 Field(name, 'upload', size=200)

 and all filenames will be limited to 200 bytes.

 On Sunday, 19 July 2015 21:06:42 UTC-5, Scott Hunter wrote:

 This is not only an issue with Windows; any filesystem with a 
 filename limit (however big) can hit this problem.  As this is all being 
 handled by web2py, and the user is selecting the file to upload, where 
 would this logic go, and why isn't web2py handling it?

 - Scott

 On Saturday, March 16, 2013 at 1:04:28 PM UTC-4, Niphlod wrote:

 I was wrong. the first part of the hash is a uuid, the second is a 
 base16 encoding of the original filename.

 Seems that you need some logic to cut down long files if you plan to 
 host on Windows.

 http://web2py.com/books/default/chapter/29/07?search=uploads#Storing-the-original-filename
  
 http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooks%2Fdefault%2Fchapter%2F29%2F07%3Fsearch%3Duploads%23Storing-the-original-filenamesa=Dsntz=1usg=AFQjCNHoAJ_7v4pFTQfLJ7w7itNYEBhoPw



-- 
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: Field('upload') : problem with file name

2015-07-20 Thread Scott Hunter
Where is this spelled out in the documentation?  I could not find it.

- Scott

On Monday, July 20, 2015 at 2:24:24 AM UTC-4, Massimo Di Pierro wrote:

 This is handled by web2py. The filenames are truncated according to the 
 size of the uploadfield. This defaults to 512. In new versions of windows 
 the make file length has been reduced so you have to do

 Field(name, 'upload', size=200)

 and all filenames will be limited to 200 bytes.

 On Sunday, 19 July 2015 21:06:42 UTC-5, Scott Hunter wrote:

 This is not only an issue with Windows; any filesystem with a filename 
 limit (however big) can hit this problem.  As this is all being handled by 
 web2py, and the user is selecting the file to upload, where would this 
 logic go, and why isn't web2py handling it?

 - Scott

 On Saturday, March 16, 2013 at 1:04:28 PM UTC-4, Niphlod wrote:

 I was wrong. the first part of the hash is a uuid, the second is a 
 base16 encoding of the original filename.

 Seems that you need some logic to cut down long files if you plan to 
 host on Windows.

 http://web2py.com/books/default/chapter/29/07?search=uploads#Storing-the-original-filename
  
 http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooks%2Fdefault%2Fchapter%2F29%2F07%3Fsearch%3Duploads%23Storing-the-original-filenamesa=Dsntz=1usg=AFQjCNHoAJ_7v4pFTQfLJ7w7itNYEBhoPw



-- 
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: Field('upload') : problem with file name

2015-07-20 Thread Scott Hunter
Is this an oversight or a conscious decision?  If I understand you, if 
one's filesystem allowed filenames greater than 512 characters, long-enough 
but still legal names will still be truncated, and thus thwart the ability 
to extract the original file name.  That could be a nasty surprise.

P.S. As I understand it, it is a permanent filename.

On Monday, July 20, 2015 at 8:47:36 AM UTC-4, Massimo Di Pierro wrote:

 Nowhere. We only state that Field(..., lenght=) is a parameter. We do 
 not say that for upload fields this is also the length of the tmp 
 filename.

 On Monday, 20 July 2015 05:28:02 UTC-5, Scott Hunter wrote:

 Where is this spelled out in the documentation?  I could not find it.

 - Scott

 On Monday, July 20, 2015 at 2:24:24 AM UTC-4, Massimo Di Pierro wrote:

 This is handled by web2py. The filenames are truncated according to the 
 size of the uploadfield. This defaults to 512. In new versions of windows 
 the make file length has been reduced so you have to do

 Field(name, 'upload', size=200)

 and all filenames will be limited to 200 bytes.

 On Sunday, 19 July 2015 21:06:42 UTC-5, Scott Hunter wrote:

 This is not only an issue with Windows; any filesystem with a filename 
 limit (however big) can hit this problem.  As this is all being handled by 
 web2py, and the user is selecting the file to upload, where would this 
 logic go, and why isn't web2py handling it?

 - Scott

 On Saturday, March 16, 2013 at 1:04:28 PM UTC-4, Niphlod wrote:

 I was wrong. the first part of the hash is a uuid, the second is a 
 base16 encoding of the original filename.

 Seems that you need some logic to cut down long files if you plan to 
 host on Windows.

 http://web2py.com/books/default/chapter/29/07?search=uploads#Storing-the-original-filename
  
 http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooks%2Fdefault%2Fchapter%2F29%2F07%3Fsearch%3Duploads%23Storing-the-original-filenamesa=Dsntz=1usg=AFQjCNHoAJ_7v4pFTQfLJ7w7itNYEBhoPw



-- 
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: Field('upload') : problem with file name

2015-07-19 Thread Scott Hunter
This is not only an issue with Windows; any filesystem with a filename 
limit (however big) can hit this problem.  As this is all being handled by 
web2py, and the user is selecting the file to upload, where would this 
logic go, and why isn't web2py handling it?

- Scott

On Saturday, March 16, 2013 at 1:04:28 PM UTC-4, Niphlod wrote:

 I was wrong. the first part of the hash is a uuid, the second is a 
 base16 encoding of the original filename.

 Seems that you need some logic to cut down long files if you plan to host 
 on Windows.

 http://web2py.com/books/default/chapter/29/07?search=uploads#Storing-the-original-filename
  
 http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooks%2Fdefault%2Fchapter%2F29%2F07%3Fsearch%3Duploads%23Storing-the-original-filenamesa=Dsntz=1usg=AFQjCNHoAJ_7v4pFTQfLJ7w7itNYEBhoPw


-- 
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: Autocomplete widgets and digital signatures

2015-06-23 Thread Scott Hunter
I have a page which has a form which includes an autocomplete widget. 
 There is a function within a controller to manage that page; this is the 
function that autocomplete widget uses.  It is not an autocomplete 
function, although it is being used (magically, according to the 
documentation) for the autocomplete functionality.  In fact, I do not 
understand (and can find no reference to) an autocomplete function in the 
documentation; the function called is the one used to generate the page 
that the autocomplete widget is on.

I *do* pass other vars to this function, and did not say otherwise: when 
called for the autocomplete, the only var is that for the autocomplete, and 
*I* never use that var (but do use others).  Nor did I say this page does 
not change state, because in fact it does (this widget is used in a form).

To be more concrete:

#@auth.requires_signature()
def edit_entry():
...
flds = []
...
flds.append( Field( handlerForAll, 'reference t_member',   
 widget = SQLFORM.widgets.autocomplete( request, db.t_member.f_Lookup, 
id_field=db.t_member.id, limitby=(0,10), min_length=2, keyword=
_autocomplete_forall ) ) )
...
form = SQLFORM.factory( *flds, formstyle=divs, submit_button=Update 
Entry )
if form.process(keepvalues=True,onvalidation=checkEntryEdit).accepted:



On Tuesday, June 23, 2015 at 11:48:24 AM UTC-4, Massimo Di Pierro wrote:

 I guess the point here is why are you using requires_signature? Normally 
 you do to make sure that only the intended party can access the intended 
 controller function. In your case it is an autocomplete function. That 
 means 1) you do not what the vars is, 2) it is not dangerous since it does 
 not change the state, 3) as you say you do not pass any other vars 
 therefore every user accesses the same set of possible autocomplete values. 

 Then you should not use @auth.requires_signature. You should use 
 @auth.requires_login() instead, simply to prevent DoS attacks.

 That said you can can do URL(..., user_signature=True, hash_vars = False) 
 along with @auth.requires_signature(hash_vars=False)

 so you hash the signature but not vars which would be added later by the 
 autocomplete JS.
 hash_vars can also be a list of variable names to be hashed.





 On Monday, 22 June 2015 09:25:07 UTC-5, Scott Hunter wrote:

 I don't see how to use this information to solve the problem.  Does any 
 URL that points to this page need to specify what vars go into the 
 signature, and what vars should be listed?  Since the autocomplete only 
 includes its own special var, and nothing else does, it seems that I'd need 
 to exclude all vars.

 This doesn't seem like that outlandish a situation; is there 
 documentation about how to handle it?

 - Scott

 On Monday, June 22, 2015 at 2:48:56 AM UTC-4, Massimo Di Pierro wrote:

 Looks at the options of URL and requires_signature. You can specify 
 which vars should be included in the signature. You cannot sign the 
 autocomplete field because that is generated by JS after web2py has already 
 computed the signature.

 On Friday, 19 June 2015 15:31:58 UTC-5, Scott Hunter wrote:

 Autocomplete widgets do not appear to work within controller functions 
 that require a digital signature (at least not for me).

 Is this a bug, a feature, or a mistake on my part?

 - Scott



-- 
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: Autocomplete widgets and digital signatures

2015-06-22 Thread Scott Hunter
I don't see how to use this information to solve the problem.  Does any URL 
that points to this page need to specify what vars go into the signature, 
and what vars should be listed?  Since the autocomplete only includes its 
own special var, and nothing else does, it seems that I'd need to exclude 
all vars.

This doesn't seem like that outlandish a situation; is there documentation 
about how to handle it?

- Scott

On Monday, June 22, 2015 at 2:48:56 AM UTC-4, Massimo Di Pierro wrote:

 Looks at the options of URL and requires_signature. You can specify which 
 vars should be included in the signature. You cannot sign the autocomplete 
 field because that is generated by JS after web2py has already computed the 
 signature.

 On Friday, 19 June 2015 15:31:58 UTC-5, Scott Hunter wrote:

 Autocomplete widgets do not appear to work within controller functions 
 that require a digital signature (at least not for me).

 Is this a bug, a feature, or a mistake on my part?

 - Scott



-- 
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: Autocomplete widgets and digital signatures

2015-06-21 Thread Scott Hunter
I was able to work around this by removing the requires_signature 
decorator, and then having the controller inspect the url for the lookup 
var that the autocomplete widget uses to know when to expect the signature 
to be missing, otherwise to require it.  This would seem to leave a 
security hole, although not a terrible one.

It still seems like this shouldn't be necessary.

- Scott

On Friday, June 19, 2015 at 4:31:58 PM UTC-4, Scott Hunter wrote:

 Autocomplete widgets do not appear to work within controller functions 
 that require a digital signature (at least not for me).

 Is this a bug, a feature, or a mistake on my part?

 - Scott


-- 
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] Autocomplete widgets and digital signatures

2015-06-19 Thread Scott Hunter
Autocomplete widgets do not appear to work within controller functions that 
require a digital signature (at least not for me).

Is this a bug, a feature, or a mistake on my part?

- Scott

-- 
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] Structure of compiled apps

2015-05-27 Thread Scott Hunter
When an app gets compiled, each function in each controller that takes no 
arguments (i.e. has an exposed URL) is represented by a .pyc file.  But 
where do the controller functions that do not correspond to exposed URLs go?

- Scott

-- 
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: Bypassing Opening Dialog in Windows Binary Startup

2015-04-30 Thread Scott Hunter
This can be accomplished by modifying *gluon.widget.py* (for example, 
opening the browser in a thread before starting the server), but that would 
violate the license (as I understand it) for using the web2py binaries, and 
I don't see any way around that.

On Wednesday, April 29, 2015 at 8:44:55 AM UTC-4, Scott Hunter wrote:

 If I run the Windows Binary without supplying an administrator password on 
 the command line, web2py presents a dialog from which you can change the 
 server address, port  admin password before starting the server; when the 
 server is started, it opens its home page in the default browser, printing 
 the console message:* starting browser*

 If the admin password *is* supplied at the command line, it skips the 
 dialog, and does not open a page in a browser,  and the console message 
 instead reads:  *use tasks /f /pid  to shutdown the web2py server*

 Is there a way to avoid the startup dialog yet still have the home page 
 open in a browser?

 - Scott


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


  1   2   >